package com.kingdee.eas.scm.common.client;

import java.awt.event.ActionEvent;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Vector;

import javax.swing.Icon;
import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities;

import org.apache.log4j.Logger;

import com.kingdee.bos.BOSException;
import com.kingdee.bos.Context;
import com.kingdee.bos.appframework.uistatemanage.ActionManager;
import com.kingdee.bos.ctrl.extendcontrols.BizDataFormat;
import com.kingdee.bos.ctrl.extendcontrols.KDBizPromptBox;
import com.kingdee.bos.ctrl.extendcontrols.ext.FilterInfoProducerFactory;
import com.kingdee.bos.ctrl.extendcontrols.ext.IFilterInfoProducer;
import com.kingdee.bos.ctrl.extendcontrols.ext.OrgUnitDelegationFilterInfoProducer;
import com.kingdee.bos.ctrl.extendcontrols.ext.OrgUnitFilterInfoProducer;
import com.kingdee.bos.ctrl.kdf.table.ICell;
import com.kingdee.bos.ctrl.kdf.table.IColumn;
import com.kingdee.bos.ctrl.kdf.table.IRow;
import com.kingdee.bos.ctrl.kdf.table.KDTDefaultCellEditor;
import com.kingdee.bos.ctrl.kdf.table.KDTSelectBlock;
import com.kingdee.bos.ctrl.kdf.table.KDTSortManager;
import com.kingdee.bos.ctrl.kdf.table.KDTable;
import com.kingdee.bos.ctrl.kdf.table.KDTableHelper;
import com.kingdee.bos.ctrl.kdf.table.event.KDTEditEvent;
import com.kingdee.bos.ctrl.kdf.table.event.KDTEditListener;
import com.kingdee.bos.ctrl.kdf.util.editor.ICellEditor;
import com.kingdee.bos.ctrl.kdf.util.render.ObjectValueRender;
import com.kingdee.bos.ctrl.report.forapp.kdnote.client.KDNoteHelper;
import com.kingdee.bos.ctrl.swing.KDLabelContainer;
import com.kingdee.bos.ctrl.swing.KDMenuItem;
import com.kingdee.bos.ctrl.swing.KDPromptBox;
import com.kingdee.bos.ctrl.swing.KDPromptSelector;
import com.kingdee.bos.ctrl.swing.KDTextField;
import com.kingdee.bos.ctrl.swing.StringUtils;
import com.kingdee.bos.ctrl.swing.event.DataChangeEvent;
import com.kingdee.bos.ctrl.swing.event.DataChangeListener;
import com.kingdee.bos.ctrl.swing.event.PreChangeEvent;
import com.kingdee.bos.ctrl.swing.event.PreChangeListener;
import com.kingdee.bos.dao.AbstractObjectValue;
import com.kingdee.bos.dao.IObjectCollection;
import com.kingdee.bos.dao.IObjectPK;
import com.kingdee.bos.dao.IObjectValue;
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
import com.kingdee.bos.invokecounter.RPCInvokeCounter;
import com.kingdee.bos.metadata.IMetaDataPK;
import com.kingdee.bos.metadata.MetaDataPK;
import com.kingdee.bos.metadata.bot.BOTMappingFactory;
import com.kingdee.bos.metadata.bot.IBOTMapping;
import com.kingdee.bos.metadata.entity.EntityViewInfo;
import com.kingdee.bos.metadata.entity.FilterInfo;
import com.kingdee.bos.metadata.entity.FilterItemInfo;
import com.kingdee.bos.metadata.query.util.CompareType;
import com.kingdee.bos.ui.face.CoreUIObject;
import com.kingdee.bos.ui.face.IItemAction;
import com.kingdee.bos.ui.face.IUIObject;
import com.kingdee.bos.ui.face.IUIWindow;
import com.kingdee.bos.ui.face.ItemAction;
import com.kingdee.bos.ui.face.UIException;
import com.kingdee.bos.ui.face.UIFactory;
import com.kingdee.bos.ui.util.IUIActionPostman;
import com.kingdee.bos.util.BOSObjectType;
import com.kingdee.bos.util.BOSUuid;
import com.kingdee.eas.base.attachment.common.AttachmentClientManager;
import com.kingdee.eas.base.attachment.common.AttachmentManagerFactory;
import com.kingdee.eas.base.codingrule.CodingRuleException;
import com.kingdee.eas.base.codingrule.CodingRuleInfo;
import com.kingdee.eas.base.codingrule.CodingRuleManagerFactory;
import com.kingdee.eas.base.codingrule.ICodingRuleManager;
import com.kingdee.eas.base.codingrule.RuleStatus;
import com.kingdee.eas.base.permission.UserInfo;
import com.kingdee.eas.base.permission.client.longtime.ILongTimeTask;
import com.kingdee.eas.basedata.assistant.ExchangeRateInfo;
import com.kingdee.eas.basedata.assistant.MeasureUnitInfo;
import com.kingdee.eas.basedata.assistant.util.CommonPrintIntegrationDataProvider;
import com.kingdee.eas.basedata.assistant.util.PrintIntegrationManager;
import com.kingdee.eas.basedata.master.cssp.CustomerInfo;
import com.kingdee.eas.basedata.master.cssp.SupplierInfo;
import com.kingdee.eas.basedata.master.cssp.client.CSClientUtils;
import com.kingdee.eas.basedata.master.material.MaterialInfo;
import com.kingdee.eas.basedata.master.material.client.MaterialEditUI;
import com.kingdee.eas.basedata.org.AdminOrgUnitInfo;
import com.kingdee.eas.basedata.org.CompanyOrgUnitInfo;
import com.kingdee.eas.basedata.org.DelegationPartsEnum;
import com.kingdee.eas.basedata.org.OrgType;
import com.kingdee.eas.basedata.org.OrgUnitCollection;
import com.kingdee.eas.basedata.org.OrgUnitInfo;
import com.kingdee.eas.basedata.org.StorageOrgUnitInfo;
import com.kingdee.eas.basedata.scm.common.BillTypeInfo;
import com.kingdee.eas.basedata.scm.common.BizTypeInfo;
import com.kingdee.eas.basedata.scm.common.RowTypeInfo;
import com.kingdee.eas.basedata.scm.common.TransactionTypeInfo;
import com.kingdee.eas.basedata.scm.im.inv.LocationInfo;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.common.client.OprtState;
import com.kingdee.eas.common.client.SysContext;
import com.kingdee.eas.common.client.UIContext;
import com.kingdee.eas.common.client.UIFactoryName;
import com.kingdee.eas.framework.ContextTypeEnum;
import com.kingdee.eas.framework.CoreBaseInfo;
import com.kingdee.eas.framework.CoreBillBaseInfo;
import com.kingdee.eas.framework.FrameWorkUtils;
import com.kingdee.eas.framework.ICoreBase;
import com.kingdee.eas.framework.batchHandler.RequestContext;
import com.kingdee.eas.framework.batchaction.BatchActionEnum;
import com.kingdee.eas.framework.batchaction.BatchSelectionEntries;
import com.kingdee.eas.framework.client.CoreBillEditUI;
import com.kingdee.eas.framework.client.service.NetFunctionService;
import com.kingdee.eas.framework.client.service.PermissionService;
import com.kingdee.eas.framework.client.service.UserMonitorService;
import com.kingdee.eas.framework.client.workflow.IWorkflowUIEnhancement;
import com.kingdee.eas.framework.client.workflow.IWorkflowUISupport;
import com.kingdee.eas.framework.print.MultiapproveDataProvider;
import com.kingdee.eas.mm.common.util.UISettingFactory;
import com.kingdee.eas.scm.common.BillBaseStatusEnum;
import com.kingdee.eas.scm.common.ISCMBillBase;
import com.kingdee.eas.scm.common.ISCMBillCommonFacade;
import com.kingdee.eas.scm.common.ISCMBillParam;
import com.kingdee.eas.scm.common.SCMBillBaseInfo;
import com.kingdee.eas.scm.common.SCMBillCommonFacadeFactory;
import com.kingdee.eas.scm.common.SCMBillEntryBaseInfo;
import com.kingdee.eas.scm.common.SCMBillException;
import com.kingdee.eas.scm.common.SCMBillParamFactory;
import com.kingdee.eas.scm.common.SCMFetchData;
import com.kingdee.eas.scm.common.SCMFetchDataCondition;
import com.kingdee.eas.scm.common.SCMFetchDataFacadeFactory;
import com.kingdee.eas.scm.common.SCMParamFacadeFactory;
import com.kingdee.eas.scm.common.action.ActionProxy;
import com.kingdee.eas.scm.common.action.ActionProxyFactory;
import com.kingdee.eas.scm.common.action.EditTableSelectionHelper;
import com.kingdee.eas.scm.common.action.IPrepareRequestContext;
import com.kingdee.eas.scm.common.action.ISupportBatchAction;
import com.kingdee.eas.scm.common.action.ISupportObjContext;
import com.kingdee.eas.scm.common.action.SCMActionManager;
import com.kingdee.eas.scm.common.client.helper.FixedDataCache;
import com.kingdee.eas.scm.common.client.helper.IUiHandling;
import com.kingdee.eas.scm.common.client.helper.UiHandlingHelperFactory;
import com.kingdee.eas.scm.common.loadmass.SCMBizDataVO;
import com.kingdee.eas.scm.common.loadmass.SCMEntryDataVO;
import com.kingdee.eas.scm.common.service.SCMServiceFactory;
import com.kingdee.eas.scm.common.trace.RPCInvokeStatckTrace;
import com.kingdee.eas.scm.common.util.F7ContextManager;
import com.kingdee.eas.scm.common.util.LongtimeIndicator;
import com.kingdee.eas.scm.common.util.MultiDataSourceDataProviderProxy;
import com.kingdee.eas.scm.common.util.SCMCommonDataProvider;
import com.kingdee.eas.scm.common.util.SortUtil;
import com.kingdee.eas.scm.common.verify.VerifyManager;
import com.kingdee.eas.scm.im.inv.IInventoryUpdate;
import com.kingdee.eas.scm.im.inv.InvBillBaseInfo;
import com.kingdee.eas.scm.im.inv.InventoryUpdateFactory;
import com.kingdee.eas.scm.im.inv.SaleIssueEntryInfo;
import com.kingdee.eas.scm.im.inv.client.BuildDecomposeBill;
import com.kingdee.eas.scm.im.inv.client.InvClientUtils;
import com.kingdee.eas.scm.im.inv.client.InventoryListUI;
import com.kingdee.eas.scm.im.rpt.client.InventoryGeneralRptUI;
import com.kingdee.eas.scm.sm.pur.PurOrderEntryInfo;
import com.kingdee.eas.util.SysUtil;
import com.kingdee.eas.util.client.EASResource;
import com.kingdee.eas.util.client.MsgBox;
import com.kingdee.util.LowTimer;
import com.kingdee.util.UuidException;

public abstract class SCMBillEditUI extends AbstractSCMBillEditUI implements ISupportObjContext, ISupportBatchAction, IPrepareRequestContext,
		IWorkflowUISupport, ISCMDEPClientExpansibility {
	private static final Logger logger = CoreUIObject.getLogger(SCMBillEditUI.class);

	private IUIWindow storageOrgWindow = null;

	private IUIWindow materialWindow = null;

	private IUIWindow inventoryWindow = null;

	private IUIWindow generalInventoryWindow = null;
	KDLabelContainer[] conts;
	private DataChangeListener prmtMaterialListener = null;

	private String orgNumber = null;

	private boolean isEditable = false;

	public boolean isAutoNumber = false;

	public boolean isAddView = false;

	public boolean isModifiable = false;

	public boolean isCoay = false;

	private KDBizPromptBox[] prmtNeedOrgF7s = null;

	private OrgUnitInfo[] mainOrgs = null;

	private int idxDefaultMainOrg = -1;

	private OrgUnitInfo mainOrg = null;

	protected VerifyManager verifyManager = new VerifyManager();

	private Map defaultOrgOnCol = null;

	private String[] fieldsToCopy = null;

	protected SCMFetchData fetchData = new SCMFetchData();

	protected F7ContextManager f7Manager = null;

	private Map parametersMap = null;

	private String[] parameters = null;

	private RuleStatus ruleStatus = null;

	private SCMBizDataVO bizDataVO = null;

	protected boolean isInSubmiting = false;
	protected static final String MENU_NAME = "MENU_NAME";
	protected static final String MENU_NUMBER = "MENU_NUMBER";
	protected static final String DESCBILL_BOSTYPE = "DESCBILL_BOSTYPE";
	protected static final String BOTPID = "BOTPID";
	protected BillOptionsHelper billOptionsHelper;
	protected PriceParamControlHelper priceParamControlHelper;
	protected IUiHandling uiHelper;
	private boolean isFirstLoading = true;

	private String rowTypeIndex = null;
	private int oldRowIndex = 0;

	private boolean isSCMFirstOnload = true;

	protected SplitOptionConfig splitOptConf = null;

	protected boolean isSpliting = false;
	protected SCMActionManager actionManager;
	private EditTableSelectionHelper tableSelectionHelper;
	protected BatchActionEnum curBizAction = null;
	public static final String INV_INPUT_OPTION_ASSISTFORNUMBER = "AssistForNumber";
	public static final String INV_INPUT_OPTION_NUMBERFORASSIST = "NumberForAssist";
	public static final String INV_STOCKTRANSFERBILL_DEFAULT_BIZTYPE = "stockTransferBillDefalutBizType";
	public static final String MATERIALREQBILL = "class com.kingdee.eas.scm.im.inv.client.MaterialReqBillEditUI";
	protected boolean assistForNumber = false;

	protected boolean numberForAssist = false;

	protected static boolean isUseProjectTrack = true;
	private static String reLoadParam = null;

	protected String defaultBizTypeId = null;

	private IMetaDataPK tDQueryPKEx = null;

	private ISCMDEPClientExpansibility scmDEPClientExpansibility = null;

	private boolean isNeedCheckBizorgUnitChange = true;

	private HashMap listenerMap = new HashMap();

	public boolean isAssistForNumber() {
		return this.assistForNumber;
	}

	public boolean isNumberForAssist() {
		return this.numberForAssist;
	}

	public ISCMDEPClientExpansibility getScmDEPClientExpansibility() {
		return this.scmDEPClientExpansibility;
	}

	public void setScmDEPClientExpansibility(ISCMDEPClientExpansibility scmDEPClientExpansibility) {
		this.scmDEPClientExpansibility = scmDEPClientExpansibility;
	}

	public boolean isNeedQtyCheck() {
		return true;
	}

	public EditTableSelectionHelper getTableSelectionHelper() {
		if (this.tableSelectionHelper == null) {
			this.tableSelectionHelper = new EditTableSelectionHelper();
		}

		return this.tableSelectionHelper;
	}

	public SCMBillEditUI() throws Exception {
		if (isSupportedBatchActions()) {
			getActionManager();
		}

		this.parametersMap = new HashMap();

		this.uiHelper = UiHandlingHelperFactory.createUiHelper(getMainBizOrgType(), this);
	}

	public boolean getIsEditable() {
		return this.isEditable;
	}

	public void onLoad() throws Exception {
		this.splitOptConf = new SplitOptionConfig(getMetaDataPK().getFullName());

		if (isFirstOnload()) {
			this.f7Manager = new F7ContextManager(this, getMainBizOrgType());

			if (isSupportedBatchActions()) {
				initBatchActions();
			}
			initNeedMainOrgF7s();
			initInFirstOnLoad();
		}

		super.onLoad();

		UISettingFactory.getInstance().displayTrackName(this);

		SCMClientHelper.addCtrlMenu(this, this.menuBiz);

		getDetailTable().setColumnMoveable(true);

		Icon iconQueryByMaterial = EASResource.getIcon("imgTbtn_demandcollateresult");

		this.menuItemQueryByMaterial.setEnabled(true);
		this.menuItemQueryByMaterial.setIcon(iconQueryByMaterial);

		this.btnQueryByMaterial.setEnabled(true);
		this.btnQueryByMaterial.setIcon(iconQueryByMaterial);

		Icon iconQueryGeneralInventory = EASResource.getIcon("imgTbtn_demandcollateresult");

		this.menuItemQueryGeneralInventory.setEnabled(true);
		this.menuItemQueryGeneralInventory.setIcon(iconQueryGeneralInventory);

		this.btnQueryGeneralInventory.setEnabled(true);
		this.btnQueryGeneralInventory.setIcon(iconQueryGeneralInventory);

		Icon iconScatter = EASResource.getIcon("imgTbtn_scatter");
		this.btnDecompose.setIcon(iconScatter);
		this.menuItemDecompose.setIcon(iconScatter);

		this.btnMaterialView.setIcon(iconQueryByMaterial);
		this.menuItemMaterialView.setIcon(iconQueryByMaterial);

		this.menuItemCustomerView.setIcon(iconQueryByMaterial);

		this.menuItemSupplierView.setIcon(iconQueryByMaterial);

		if (isSplitLine()) {
			Icon iconSplit = EASResource.getIcon("imgTbtn_split");
			this.btnSplitLine.setIcon(iconSplit);
			this.menuItemSplitLine.setIcon(iconSplit);

			if (isSplitLine()) {
				this.btnSplitLine.setVisible(true);
				this.menuItemSplitLine.setVisible(true);

				this.menuItemSplitOption.setVisible(true);
				this.actionSplitLine.setVisible(true);
				this.actionSplitOption.setVisible(true);
				if ((this.editData == null) || (this.editData.getBaseStatus().equals(BillBaseStatusEnum.AUDITED)) || ("VIEW".equals(getOprtState()))
						|| ("FINDVIEW".equals(getOprtState()))) {
					setSplitLineEnable(false);
				} else
					setSplitLineEnable(true);

				if (((this.editData instanceof InvBillBaseInfo)) && (((InvBillBaseInfo) this.editData).isIsReversed())) {
					setSplitLineEnable(false);
				}

			}

		}

		setSeparator();

		if (getDetailTable() != null) {
			getDetailTable().getActionMap().remove("AddRow");
			getDetailTable().getActionMap().remove("RemoveRow");
			getDetailTable().getActionMap().remove("Delete");
			getDetailTable().getActionMap().remove("Paste");
		}

		if (getDetailTable() != null) {
			KDTSortManager sortManager = new KDTSortManager(getDetailTable());
			sortManager.setSortAuto(true);
			for (int i = 0; i < getDetailTable().getColumnCount(); i++) {
				getDetailTable().getColumn(i).setSortable(true);
			}
		}

		this.MenuItemAttachment.setVisible(true);
		this.actionAttachment.setEnabled(true);
		this.btnAttachment.setVisible(true);

		if (getMainBizOrg() != null) {
			setMainBizOrgF7(getMainBizOrg(), getMainBizOrgType());

			getMainBizOrg().setRequired(true);
		}

		if (getNumTextField() != null) {
			getNumTextField().setMaxLength(80);
		}

		OrgUnitInfo orgUnitInfo = (OrgUnitInfo) getUIContext().get(getMainBizOrgType());

		OrgUnitInfo sysOrgUnitInfo = SysContext.getSysContext().getCurrentOrgUnit();

		if ((this.isFirstLoading) && (orgUnitInfo != null)) {
			String sysOrgId = null;
			if (sysOrgUnitInfo != null) {
				sysOrgId = sysOrgUnitInfo.getId().toString();
			}

			afterMainOrgChanged(sysOrgId, orgUnitInfo.getId().toString());
		} else {
			changeF7Context();
		}

		if (("EDIT".equals(getOprtState())) || ("ADDNEW".equals(getOprtState()))) {
			CoreBaseInfo info = (CoreBaseInfo) getMainOrgUnit().getData();
			if ((info != null) && (info.getId() != null)) {
				String infoID = info.getId().toString();
				setNumEditableWhenUnitChange(infoID);
			}

		}

		if (("ADDNEW".equals(getOprtState())) || ((this.editData != null) && (this.editData.getBaseStatus().equals(BillBaseStatusEnum.ADD)))) {
			setDefaultOrgOnColumn(isFromBotpNewOrEdit());
		}

		if (this.isSCMFirstOnload) {
			if ((getSCMBizDataVO() != null) && (getSCMBizDataVO().getPeriodYear() > 0)) {
				setCurPeriod(SCMClientUtils.getPeriodDisplay(getSCMBizDataVO().getPeriodYear(), getSCMBizDataVO().getPeriodNumber()));
			}

			setBizProcessControl();
		}

		this.isSCMFirstOnload = false;
		this.tableSelectionHelper.setIdList(this.idList);

		setScmDEPClientExpansibility(this);

		this.menuItemInvBillOptin.setVisible(false);
		this.menuItemInvBillOptin.setEnabled(false);

		if ((isNeedSepcialParam()) && (reLoadParam == null)) {
			String[] keys = { "isUseProjectTrack" };
			HashMap map = SCMParamFacadeFactory.getRemoteInstance().getScmSpecialParams(keys);
			isUseProjectTrack = map.get("isUseProjectTrack") == null ? true : ((Boolean) map.get("isUseProjectTrack")).booleanValue();
			reLoadParam = "notReLoad";
		}
	}

	protected boolean isNeedSepcialParam() {
		return false;
	}

	public void actionSplitOption_actionPerformed(ActionEvent e) throws Exception {
		UIContext uiContext = new UIContext(this);
		uiContext.put("className", getMetaDataPK().getFullName());
		uiContext.put("splitOptConf", this.splitOptConf);
		IUIWindow uiWindow = UIFactory.createUIFactory(UIFactoryName.MODEL).create(SplitLineOptionUI.class.getName(), uiContext, null, null);

		uiWindow.show();
	}

	protected void computeAmountFields(KDTable detailTable, int row) {
		KDTEditEvent e = null;
		for (int i = 0; i < detailTable.getColumnCount(); i++) {
			String colKey = detailTable.getColumnKey(i);
			if ((colKey != null) && (colKey.toLowerCase().equals("qty"))) {
				e = new KDTEditEvent(detailTable, null, detailTable.getCell(row, i).getValue(), row, i, false, 1);
				try {
					for (int loopListeners = 0; loopListeners < detailTable.getListeners(KDTEditListener.class).length; loopListeners++)
						((KDTEditListener) detailTable.getListeners(KDTEditListener.class)[loopListeners]).editStopped(e);
				} catch (Exception err) {
				}
			}
		}
	}

	protected BigDecimal divQty(BigDecimal source, int num) {
		if ((source == null) || (num < 2))
			return null;
		return source.divide(new BigDecimal(num), source.scale(), 4);
	}

	protected String[] getSplitFields() {
		return null;
	}

	private boolean isSplitField(String colKey) {
		String[] splitKeys = getSplitFields();
		if (colKey != null) {
			if (colKey.toLowerCase().endsWith("qty")) {
				return true;
			}
			if (splitKeys != null) {
				for (int i = 0; i < splitKeys.length; i++) {
					if (colKey.equals(splitKeys[i]))
						return true;
				}
			}
		}
		return false;
	}

	protected void splitQty(List rowIndexList, int splitNum) {
		KDTable detailTable = getDetailTable();
		ICell cell = null;
		IRow row = null;
		BigDecimal oldQty = null;
		BigDecimal newQty = null;
		SCMBillEntryBaseInfo detailData = null;

		int counter = 0;
		boolean isZeroValue = false;
		for (int i = 0; i < detailTable.getColumnCount(); i++)
			if (isSplitField(detailTable.getColumnKey(i))) {
				counter = 0;
				isZeroValue = false;
				for (int j = 0; j < rowIndexList.size(); j++) {
					cell = detailTable.getCell(((Integer) rowIndexList.get(j)).intValue(), i);
					if (cell.getValue() == null)
						break;
					if (isZeroValue) {
						cell.setValue(new BigDecimal(0.0D));
					} else {
						counter++;
						if (counter == 1) {
							oldQty = ((BigDecimal) cell.getValue()).abs();

							newQty = divQty(oldQty, splitNum);
						}
						try {
							if ((newQty.multiply(new BigDecimal(counter)).compareTo(oldQty) <= 0) && (j < rowIndexList.size() - 1)) {
								cell.setValue(newQty);
							} else {
								cell.setValue(oldQty.subtract(newQty.multiply(new BigDecimal(counter - 1))));
								isZeroValue = true;
							}
						} catch (Exception e) {
							cell.setValue(SCMClientUtils.ZERO);
						}
					}
				}
			}
		for (int i = 0; i < rowIndexList.size(); i++) {
			row = detailTable.getRow(((Integer) rowIndexList.get(i)).intValue());
			detailData = (SCMBillEntryBaseInfo) row.getUserObject();

			storeLineFields(detailTable, row, detailData);
			computeAmountFields(detailTable, row.getRowIndex());
		}
	}

	public void splitOrCopyLine(boolean isCopy) throws Exception {
		if (this.editData == null) {
			return;
		}

		if ((this.editData.getBaseStatus().equals(BillBaseStatusEnum.ADD)) && (isBotpBill())) {
			MsgBox.showInfo(this, InvClientUtils.getResource("ISBOTPBILLANDADDNOSPLIT"));
			return;
		}

		if (this.editData.getBaseStatus().equals(BillBaseStatusEnum.AUDITED)) {
			MsgBox.showInfo(this, InvClientUtils.getResource("AUDITNOSPLIT"));
			return;
		}

		if (((this.editData instanceof InvBillBaseInfo)) && (((InvBillBaseInfo) this.editData).isIsReversed())) {
			MsgBox.showInfo(this, InvClientUtils.getResource("RESBILLNOSPLIT"));
			return;
		}

		KDTable detialTable = getDetailTable();
		if (detialTable != null) {
			String noSelectStr = "NOSELNOSPLIT";
			String multiSelectStr = "NO_SPLIT_MULTI_LINE";
			if (isCopy) {
				noSelectStr = "NOSELNOCOPY";
				multiSelectStr = "NO_COPY_MULTI_LINE";
			}

			if (detialTable.getSelectManager().size() == 0) {
				MsgBox.showInfo(this, InvClientUtils.getResource(noSelectStr));

				return;
			}

			int topRow = detialTable.getSelectManager().get().getBeginRow();

			int endRow = detialTable.getSelectManager().get().getEndRow();
			if ((topRow < 0) && (endRow >= 0)) {
				topRow = 0;
			}

			if (SCMClientHelper.checkIsTotalLine(detialTable.getRow(topRow))) {
				MsgBox.showInfo(this, InvClientUtils.getResource("ISTOTALROW"));
				return;
			}

			storeLineFields(detialTable, detialTable.getRow(topRow), null);

			SCMBillEntryBaseInfo entryInfo = (SCMBillEntryBaseInfo) detialTable.getRow(topRow).getUserObject();

			if (((entryInfo instanceof SaleIssueEntryInfo)) && (((SaleIssueEntryInfo) entryInfo).isIsLocked())) {
				MsgBox.showInfo(this, InvClientUtils.getResource("ISLOCKEDROW"));
				return;
			}

			boolean isPurOrder = false;
			if ((entryInfo instanceof PurOrderEntryInfo)) {
				isPurOrder = true;
			}

			storeLineFields(detialTable, detialTable.getRow(topRow), entryInfo);

			List detailDataList = null;
			if (!isCopy)
				detailDataList = getSplitLineData(entryInfo, this.splitOptConf.getSplitNum(), this.splitOptConf.getSplitType());
			if ((detailDataList == null) || (detailDataList.isEmpty()))
				return;
			logger.debug("detailDataList.size:" + detailDataList.size() + ", splitOptConf.getSplitNum():" + this.splitOptConf.getSplitNum());

			HashMap hsEntryRetion = new HashMap(0);

			SCMBillEntryBaseInfo detailData = null;
			List rowIndexList = new ArrayList();
			rowIndexList.add(new Integer(topRow));
			for (int i = 0; i < detailDataList.size(); i++) {
				logger.debug("readu adding a new line:" + i);
				detailData = (SCMBillEntryBaseInfo) detailDataList.get(i);
				IRow row = null;
				if (this.splitOptConf.getSplitPos() == 0) {
					endRow = topRow + i + 1;
					row = detialTable.addRow(endRow);
				} else {
					endRow = detialTable.getRowCount();
					row = detialTable.addRow(endRow);
				}
				rowIndexList.add(new Integer(endRow));

				loadLineFields(detialTable, row, detailData);
				storeLineFields(detialTable, row, detailData);
				logger.debug("added a new line, row index:" + endRow);

				this.isCoay = false;

				if ((entryInfo.getSourceBillEntryId() == null) || (this.editData.getId() == null) || (detailData.getId() == null)
						|| (entryInfo.getId() == null)) {
					continue;
				}
				if ((entryInfo.get("isInitBill") != null) && (((Boolean) entryInfo.get("isInitBill")).booleanValue()))
					continue;
				hsEntryRetion.put(detailData.getId().toString(), entryInfo.getId().toString());
			}

			if ((!isCopy) && (this.splitOptConf.getSplitType() == 0)) {
				splitQty(rowIndexList, this.splitOptConf.getSplitNum());
			}
			if (!isCopy) {
				for (int i = 1; i < rowIndexList.size(); i++) {
					int row = ((Integer) rowIndexList.get(i)).intValue();
					LocationInfo location = (LocationInfo) getDetailTable().getCell(row, "location").getValue();
					setColumnProperty(entryInfo.getMaterial(), row, 0, true);
					getDetailTable().getCell(row, "location").setValue(location);
				}
			}

			if (this.editData.getId() != null) {
				if (hsEntryRetion.size() > 0) {
					ISCMBillCommonFacade iScmBillCommonFacade = SCMBillCommonFacadeFactory.getRemoteInstance();
					iScmBillCommonFacade.saveNewEentyReation(this.editData.getId().toString(), hsEntryRetion);
				}
			}

			if (isPurOrder)
				updateFetchSupplyInfo(rowIndexList);
		}
	}

	public void actionSplitLine_actionPerformed(ActionEvent e) throws Exception {
		this.isSpliting = true;
		splitOrCopyLine(false);
		this.isSpliting = false;
	}

	protected void updateFetchSupplyInfo(List list) throws Exception {
	}

	protected void setColumnProperty(MaterialInfo materialInfo, int row, int col, boolean isOnload) throws Exception {
	}

	protected List getSplitLineData(SCMBillEntryBaseInfo entryInfo, int splitNum, int splitType) {
		return null;
	}

	protected boolean isSplitLine() {
		return false;
	}

	private void setSeparator() {
		JPopupMenu.Separator[] separators = { this.separator1, this.separator2, this.separator3, this.separator9, this.separator10, this.separator11,
				this.separator12 };

		int i = 0;
		for (int c = separators.length; i < c; i++) {
			separators[i].setVisible(true);
			separators[i].setEnabled(true);
		}
	}

	public void onShow() throws Exception {
		super.onShow();

		SCMClientUtils.setShortCutKey(this, this.actionAudit);

		SCMClientUtils.setShortCutKey(this, this.actionUnAudit);

		if (!this.isEditable)
			getNumTextField().setAccessAuthority(1);
		else {
			getNumTextField().setEnabled(this.isEditable);
		}
		getNumTextField().setEditable(this.isEditable);

		if (getMainOrgUnit() != null) {
			if ((this.editData.getBaseStatus() == BillBaseStatusEnum.ADD) && (!isBotpBill())) {
				getMainOrgUnit().setAccessAuthority(0);

				getMainOrgUnit().setEditable(true);
			} else {
				getMainOrgUnit().setAccessAuthority(1);

				getMainOrgUnit().setAccessAuthority(1);

				getMainOrgUnit().setEditable(false);
			}
		}
	}

	public void storeFields() {
		super.storeFields();
	}

	public IObjectPK runSubmit() throws Exception {
		return super.runSubmit();
	}

	public IObjectPK runSave() throws Exception {
		String orgUnitID = null;
		CoreBaseInfo info = (CoreBaseInfo) getMainOrgUnit().getData();
		if (getMainOrgUnit() != null) {
			if ((info != null) && (info.getId() != null)) {
				orgUnitID = info.getId().toString();
			} else {
				String msg1 = EASResource.getString("com.kingdee.eas.scm.common.SCMResource.MAINBIZORGISNULL");

				MsgBox.showInfo(this, msg1);
				getMainOrgUnit().requestFocus(true);
				SysUtil.abort();
			}

		}

		return super.runSave();
	}

	public void actionFillColumn_actionPerformed(ActionEvent e) throws Exception {
		super.actionFillColumn_actionPerformed(e);
	}

	public void actionQueryByMaterial_actionPerformed(ActionEvent e) throws Exception {
		HashMap hm = getQueryCondition();
		if (hm == null) {
			return;
		}

		MaterialInfo aMaterialInfo = (MaterialInfo) hm.get("MATERIAL");

		StorageOrgUnitInfo aStorageOrgUnitInfo = (StorageOrgUnitInfo) hm.get("STORAGEORGUNIT");

		if (aMaterialInfo == null) {
			queryResultByInventory(hm);
		} else
			queryResultByMaterial(hm);
	}

	public void actionMaterialView_actionPerformed(ActionEvent e) throws Exception {
		HashMap hm = getQueryCondition();
		if (hm == null) {
			return;
		}
		try {
			MaterialInfo aMaterialInfo = (MaterialInfo) hm.get("MATERIAL");

			if ((aMaterialInfo != null) && (aMaterialInfo.getId() != null)) {
				String id = aMaterialInfo.getId().toString();

				UIContext uiContext = new UIContext(this);
				uiContext.put("ID", id);
				IUIWindow materialViewWindow = UIFactory.createUIFactory(UIFactoryName.MODEL).create(
						"com.kingdee.eas.basedata.master.material.client.MaterialEditUI", uiContext, null, OprtState.VIEW);

				((MaterialEditUI) materialViewWindow.getUIObject()).hideAddEditBtn();

				materialViewWindow.show();
			} else {
				MsgBox.showInfo(this, EASResource.getString("com.kingdee.eas.scm.common.SCMResource", "NoEntrySelected"));
			}
		} catch (Exception e1) {
			handUIException(e1);
		}
	}

	public void actionQueryGeneralInventory_actionPerformed(ActionEvent e) throws Exception {
		StorageOrgUnitInfo storageOrg = new StorageOrgUnitInfo();
		ArrayList materialArray = new ArrayList();
		getMultiLinesQueryCondition(storageOrg, materialArray);
		if ((storageOrg != null) && (materialArray.size() > 1)) {
			queryStoreStateTotalView(storageOrg, materialArray);
			return;
		}

		HashMap hm = getQueryCondition();
		if (hm == null) {
			return;
		}
		queryGeneralInventory(hm);
	}

	protected String getEntryMaterialFieldName() {
		return null;
	}

	protected void getMultiLinesQueryCondition(StorageOrgUnitInfo org, ArrayList materialArray) throws Exception {
		if (getMainBizOrg() == null)
			return;
		if (!(getMainBizOrg().getData() instanceof StorageOrgUnitInfo))
			return;
		StorageOrgUnitInfo aStorageOrgUnitInfo = (StorageOrgUnitInfo) getMainBizOrg().getData();
		org.setId(aStorageOrgUnitInfo.getId());

		KDTSelectBlock selectBlock = getDetailTable().getSelectManager().get();
		HashMap map = new HashMap();
		if (selectBlock != null) {
			int rowIndex = selectBlock.getTop();
			int endRowIndex = selectBlock.getBottom();

			for (int index = rowIndex; index <= endRowIndex; index++) {
				IRow row = getDetailTable().getRow(index);
				if (row == null) {
					return;
				}

				if (getEntryMaterialFieldName() == null)
					return;
				ICell cell = row.getCell(getEntryMaterialFieldName());
				MaterialInfo material = (MaterialInfo) cell.getValue();
				if ((material == null) || (material.getId() == null))
					continue;
				if (map.containsKey(material.getId().toString()))
					continue;
				map.put(material.getId().toString(), material.getId().toString());
				materialArray.add(material);
			}
		}
	}

	private void queryResultByMaterial(HashMap hm) throws UIException, BOSException, Exception, SQLException {
		UIContext uiContext = new UIContext(this);

		boolean isSetAndBackButtonVisable = true;
		TransactionTypeInfo aTransactionTypeInfo = (TransactionTypeInfo) hm.get("TRANSACTIONTYPE");
		BizTypeInfo bizTypeInfo = (BizTypeInfo) hm.get("BIZTYPE");
		BizTypeInfo bizType = null;
		if (aTransactionTypeInfo != null) {
			bizType = aTransactionTypeInfo.getBizType();
			if ((bizType != null)
					&& (bizType.getId() != null)
					&& (("i6DbShN4SLaNlFkX90UXOiQHQ1w=".equals(bizType.getId().toString()))
							|| ("YJN9V65PSkutQxeUH6F72SQHQ1w=".equals(bizType.getId().toString()))
							|| ("nhvcdx82RzuTw48FSlV79CQHQ1w=".equals(bizType.getId().toString()))
							|| ("mu6sevVMS9+JhGPjGuP7siQHQ1w=".equals(bizType.getId().toString())) || ("HCZs8ltBSBiBTR5keu33YCQHQ1w=".equals(bizType.getId()
							.toString())))) {
				uiContext.put("UIClassParam", Boolean.FALSE.toString());
			}
		} else if ((bizTypeInfo != null) && (bizTypeInfo.getId() != null)) {
			if (("i6DbShN4SLaNlFkX90UXOiQHQ1w=".equals(bizTypeInfo.getId().toString()))
					|| ("YJN9V65PSkutQxeUH6F72SQHQ1w=".equals(bizTypeInfo.getId().toString()))
					|| ("nhvcdx82RzuTw48FSlV79CQHQ1w=".equals(bizTypeInfo.getId().toString()))
					|| ("mu6sevVMS9+JhGPjGuP7siQHQ1w=".equals(bizTypeInfo.getId().toString()))
					|| ("HCZs8ltBSBiBTR5keu33YCQHQ1w=".equals(bizTypeInfo.getId().toString()))) {
				uiContext.put("UIClassParam", Boolean.FALSE.toString());
			}

		}

		if ((null != uiContext) && (uiContext.size() > 0)) {
			Object fromUi = uiContext.get("Owner");

			if ((null != fromUi) && ((fromUi instanceof CoreBillEditUI)))
				isSetAndBackButtonVisable = true;
			else {
				isSetAndBackButtonVisable = false;
			}
			Object param = uiContext.get("UIClassParam");
			if ((null != param) && ((param instanceof String)) && (param.equals(Boolean.FALSE.toString()))) {
				isSetAndBackButtonVisable = false;
			}

		}

		if (this.materialWindow == null) {
			this.materialWindow = UIFactory.createUIFactory(UIFactoryName.MODEL).create("com.kingdee.eas.scm.common.client.MaterialQueryListUI", uiContext,
					null, OprtState.EDIT);
		}

		MaterialQueryListUI aMaterialQueryListUI = (MaterialQueryListUI) this.materialWindow.getUIObject();

		aMaterialQueryListUI.setSetAndBackButtonVisiable(isSetAndBackButtonVisable);

		aMaterialQueryListUI.setHmQueryCon(hm);
		aMaterialQueryListUI.executQuery();
		this.materialWindow.show();

		HashMap hmResult = aMaterialQueryListUI.getHmResult();
		Object needSet = hmResult.get("needSet");
		if (needSet != null)
			setLotAndAssistProperty(hmResult);
	}

	protected void setLotAndAssistProperty(HashMap hmResult) {
	}

	private void queryResultByStorageOrgUnit(HashMap hm) throws Exception {
		UIContext uiContext = new UIContext(this);

		if (this.storageOrgWindow == null) {
			this.storageOrgWindow = UIFactory.createUIFactory(UIFactoryName.MODEL).create("com.kingdee.eas.scm.common.client.StorageOrgQueryListUI", uiContext,
					null, OprtState.EDIT);
		}

		StorageOrgQueryListUI aStorageOrgQueryListUI = (StorageOrgQueryListUI) this.storageOrgWindow.getUIObject();

		aStorageOrgQueryListUI.setHmQueryCon(hm);
		aStorageOrgQueryListUI.executQuery();
		this.storageOrgWindow.show();
	}

	private void queryResultByInventory(HashMap hm) throws Exception {
		UIContext uiContext = new UIContext(this);
		uiContext.put("STORAGEORGUNIT", hm.get("STORAGEORGUNIT"));

		this.inventoryWindow = UIFactory.createUIFactory(UIFactoryName.MODEL).create("com.kingdee.eas.scm.im.inv.client.InventoryListUI", uiContext, null,
				OprtState.EDIT);

		InventoryListUI aInventoryListUI = (InventoryListUI) this.inventoryWindow.getUIObject();

		this.inventoryWindow.show();
	}

	private void queryGeneralInventory(HashMap hm) throws UIException, BOSException, Exception, SQLException {
		UIContext uiContext = new UIContext(this);
		if (this.generalInventoryWindow == null) {
			this.generalInventoryWindow = UIFactory.createUIFactory(UIFactoryName.MODEL).create("com.kingdee.eas.scm.im.rpt.client.InventoryGeneralRptUI",
					uiContext, null, OprtState.VIEW);
		}

		InventoryGeneralRptUI inventoryGeneralUI = (InventoryGeneralRptUI) this.generalInventoryWindow.getUIObject();

		inventoryGeneralUI.setHmQueryCon(hm);
		inventoryGeneralUI.changeRpt();
		this.generalInventoryWindow.show();
	}

	protected void queryStoreStateTotalView(StorageOrgUnitInfo org, ArrayList materialArr) throws UIException, BOSException, Exception, SQLException {
	}

	protected HashMap getQueryCondition() throws Exception {
		return null;
	}

	public void actionClearBill_actionPerformed(ActionEvent e) throws Exception {
		super.actionClearBill_actionPerformed(e);
	}

	protected void setFieldsNull(AbstractObjectValue newData) {
		SCMBillBaseInfo aSCMBillBaseInfo = (SCMBillBaseInfo) newData;
		aSCMBillBaseInfo.setId(null);

		aSCMBillBaseInfo.setNumber(null);
		Date today = new Date();
		aSCMBillBaseInfo.setBizDate(today);
		aSCMBillBaseInfo.setBaseStatus(BillBaseStatusEnum.ADD);
		aSCMBillBaseInfo.setCreateTime(new Timestamp(today.getTime()));
		aSCMBillBaseInfo.setLastUpdateTime(null);
		aSCMBillBaseInfo.setLastUpdateUser(null);
		aSCMBillBaseInfo.setModifier(null);
		aSCMBillBaseInfo.setModificationTime(null);

		UserInfo aUserInfo = SysContext.getSysContext().getCurrentUserInfo();

		aSCMBillBaseInfo.setCreator(aUserInfo);

		aSCMBillBaseInfo.setAuditor(null);
		aSCMBillBaseInfo.setAuditTime(null);

		aSCMBillBaseInfo.setCU(SysContext.getSysContext().getCurrentCtrlUnit());
		try {
			if (isBotpBill()) {
				setMakeRelations(null);
			}
		} catch (Exception e) {
			handUIException(e);
		}
	}

	public void actionAudit_actionPerformed(ActionEvent e) throws Exception {
		getDetailTable().getEditManager().stopEditing();
		String id = null;
		super.actionAudit_actionPerformed(e);
		boolean isSubmitAndAddNew = this.chkMenuItemSubmitAndAddNew.isSelected();
		this.chkMenuItemSubmitAndAddNew.setSelected(false);
		try {
			if ((this.editData == null) || (this.editData.getId() == null)) {
				String msg = EASResource.getString("com.kingdee.eas.scm.common.SCMResource.BillCantAudit");

				MsgBox.showWarning(this, msg);
				return;
			}
			id = this.editData.getId().toString();
			try {
				pubFireVOChangeListener(id);
			} catch (Throwable e1) {
				e1.printStackTrace();
				MsgBox.showWarning(this, EASResource.getString("com.kingdee.eas.framework.FrameWorkResource.Error_ObjectUpdateLock_Request"));

				loadFields();

				this.chkMenuItemSubmitAndAddNew.setSelected(isSubmitAndAddNew);
				return;
			}
			if (this.editData.getBaseStatus() == BillBaseStatusEnum.TEMPORARILYSAVED) {
				String msg = EASResource.getString("com.kingdee.eas.scm.common.SCMResource.NotAudit");

				MsgBox.showWarning(this, msg);
				return;
			}
			ObjectUuidPK pk = new ObjectUuidPK(this.editData.getId());
			if (isModify()) {
				int result = MsgBox.showConfirm3(this, EASResource.getString("com.kingdee.eas.framework.FrameWorkResource.Confirm_Save_Check"));
				if (result == 0) {
					String billTypeId = this.editData.getBillType().getId().toString();
					String orgUnitID = getMainOrgInfo().getId().toString();

					boolean isAutoAudit = false;
					ISCMBillParam scmParam = SCMBillParamFactory.getRemoteInstance();
					String strAutoAudit = scmParam.getParamByBillTypeID("SCM_Submit_01", getMainBizOrgType().getValue(), orgUnitID, billTypeId);
					if ((strAutoAudit != null) && (strAutoAudit.trim().length() != 0) && (strAutoAudit.trim().toLowerCase().equals("1"))) {
						isAutoAudit = true;
					}

					ActionEvent event = new ActionEvent(this.btnSubmit, 1001, this.btnSubmit.getActionCommand());
					this.actionSubmit.actionPerformed(event);
					if (this.actionSubmit.isInvokeFailed()) {
						SysUtil.abort();
					}
					if (isAutoAudit) {
						setDataObject(getValue(pk));
						loadFields();
						setSave(true);
						setSaved(true);

						this.actionTraceUp.setEnabled(true);
						this.actionTraceDown.setEnabled(true);
						return;
					}
				} else if (result == 2) {
					SysUtil.abort();
				}
			}
			if (!checkBeforeAudit()) {
				return;
			}
			String[] idListArray = new String[1];
			idListArray[0] = this.editData.getId().toString();

			ArrayList IDsInWF = SCMClientUtils.getIDsInActiveWorkFlow(idListArray);

			if (IDsInWF.size() != 0) {
				actionMultiapprove_actionPerformed(null);
				try {
					setOprtState("RELEASEALL");
					pubFireVOChangeListener(id);
				} catch (Throwable e2) {
					handUIException(e2);
				}

				if (this.editData.getId() != null) {
					this.editData = ((SCMBillBaseInfo) getValue(pk));
					if (this.editData.getBaseStatus() != BillBaseStatusEnum.AUDITED) {
						Thread.sleep(2000L);
						this.editData = ((SCMBillBaseInfo) getValue(pk));
					}
					if (this.editData.getBaseStatus() == BillBaseStatusEnum.AUDITED)
						setOprtState(OprtState.VIEW);
					else {
						setOprtState(OprtState.EDIT);
					}
					setDataObject(this.editData);
					loadFields();
					setSave(true);
					setSaved(true);

					this.actionTraceUp.setEnabled(true);
					this.actionTraceDown.setEnabled(true);
				}
				return;
			}

			ISCMBillBase iSCMBillBase = (ISCMBillBase) getBizInterface();
			iSCMBillBase.passAudit(pk, this.editData);
			try {
				setOprtState("RELEASEALL");
				pubFireVOChangeListener(id);
			} catch (Throwable e2) {
				handUIException(e2);
			}

			this.editData = ((SCMBillBaseInfo) getValue(pk));
			if (this.editData.getBaseStatus() == BillBaseStatusEnum.AUDITED)
				setOprtState(OprtState.VIEW);
			else {
				setOprtState(OprtState.EDIT);
			}
			setDataObject(this.editData);

			setSave(true);
			setSaved(true);

			this.actionTraceUp.setEnabled(true);
			this.actionTraceDown.setEnabled(true);
		} catch (Exception e1) {
			handUIException(e1);
		} finally {
			loadFields();

			this.chkMenuItemSubmitAndAddNew.setSelected(isSubmitAndAddNew);
		}
	}

	public void actionUnAudit_actionPerformed(ActionEvent e)
    throws Exception
  {
    String tempState = getOprtState();
    try
    {
      checkSelected();
      if (!confirmUnAduit()) {
        return;
      }

      if (this.editData.getBaseStatus() != BillBaseStatusEnum.AUDITED)
      {
        String msg = EASResource.getString("com.kingdee.eas.scm.common.SCMResource.NotUnAudit");
        MsgBox.showWarning(this, msg);
        return;
      }

      ObjectUuidPK pk = new ObjectUuidPK(this.editData.getId());
      ISCMBillBase iSCMBillBase = (ISCMBillBase)getBizInterface();
      iSCMBillBase.unAudit(pk);

      setDataObject(getValue(pk));
      loadFields();
      setSave(true);
      setSaved(true);

      this.actionTraceUp.setEnabled(true);
      this.actionTraceDown.setEnabled(true);
      this.btnEdit.setEnabled(true);
    }
    catch (Exception e1) {
      handUIException(e1);
    }
    finally {
      try {
        setOprtState("RELEASEALL");

        setOprtState(tempState);
        pubFireVOChangeListener(null);
      } catch (Throwable e2) {
        handUIException(e2);
      }
    }
  }

	public void checkSelected() {
		if ((this.editData == null) || (this.editData.getId() == null)) {
			MsgBox.showWarning(this, EASResource.getString("com.kingdee.eas.framework.FrameWorkResource.Msg_MustSelected"));

			SysUtil.abort();
		}
	}

	public boolean checkBeforeAudit() throws Exception {
		return true;
	}

	protected BigDecimal calculateSum(KDTable table, String colunmName) {
		BigDecimal ret = new BigDecimal(0.0D);
		String str = null;
		Object o = null;
		for (int i = 0; i < table.getRowCount(); i++) {
			o = table.getRow(i).getCell(colunmName).getValue();
			if (o != null) {
				str = o.toString();
				if ((str != null) && (com.kingdee.eas.scm.common.util.StringUtil.isNumber(str))) {
					BigDecimal value = new BigDecimal(str);

					ret = ret.add(value);
				}
			}
		}

		return ret;
	}

	public String getBindingProperty() {
		return null;
	}

	public KDTextField getNumTextField() {
		return null;
	}

	public KDBizPromptBox getMainOrgUnit() {
		return null;
	}

	public void setNumWhereCopy() throws Exception {
		if (getMainOrgUnit() != null) {
			CoreBaseInfo info = (CoreBaseInfo) getMainOrgUnit().getData();
			if ((info != null) && (info.getId() != null)) {
				String infoID = info.getId().toString();
				setNumEditableWhenUnitChange(infoID);

				if ("ADDNEW".equals(getOprtState())) {
					this.isAutoNumber = isAutoNumber(infoID);
					if (this.isAutoNumber) {
						this.isAddView = isAddView(infoID);

						if (this.isAddView) {
							getNumTextField().setText(null);
							String newNum = getSCMBizDataVO().getBillNumber() != null ? getSCMBizDataVO().getBillNumber() : getNewNumberByUnit(infoID);

							getNumTextField().setText(newNum);
							this.editData.setNumber(newNum);
							initOldData(this.editData);
						}
						setEditable(false);
						if (isModifiable(infoID))
							setEditable(true);
					} else {
						setEditable(true);
					}
				}
			}
		}
	}

	public boolean isCreatNumberBySupper() {
		return true;
	}

	public void setNumEditableWhenUnitChange(String strCompanyID) {
		try {
			this.isAutoNumber = isAutoNumber(strCompanyID);

			if (this.isAutoNumber) {
				this.isModifiable = isModifiable(strCompanyID);
				if (this.isModifiable) {
					if (("VIEW".equals(getOprtState())) || ("FINDVIEW".equals(getOprtState()))) {
						getNumTextField().setEditable(false);

						getNumTextField().setAccessAuthority(1);
						this.isEditable = false;
					} else {
						getNumTextField().setEditable(true);
						getNumTextField().setAccessAuthority(0);
						getNumTextField().setEnabled(true);
						this.isEditable = true;

						getNumTextField().requestFocus();
					}
				} else {
					getNumTextField().setEditable(false);

					getNumTextField().setAccessAuthority(1);
					this.isEditable = false;
				}
			} else if (("VIEW".equals(getOprtState())) || ("FINDVIEW".equals(getOprtState()))) {
				getNumTextField().setEditable(false);

				getNumTextField().setAccessAuthority(1);
				this.isEditable = false;
			} else {
				getNumTextField().setEditable(true);
				getNumTextField().setEnabled(true);
				getNumTextField().setAccessAuthority(0);
				this.isEditable = true;
				getNumTextField().requestFocus();
			}
		} catch (Exception e) {
			handUIException(e);
		}
	}

	/** @deprecated */
	public void setNumberEnabled() {
	}

	/** @deprecated */
	public void setNumberEnabled(String bizOrgUnitID) {
		if ((this.editData == null) || (getNumTextField() == null)) {
			return;
		}
		try {
			this.isAutoNumber = isAutoNumber(bizOrgUnitID);
			if (("ADDNEW".equals(getOprtState())) && (this.isAutoNumber)) {
				this.isAddView = isAddView(bizOrgUnitID);
				ICodingRuleManager iCodingRuleManager = CodingRuleManagerFactory.getRemoteInstance();

				String strOrgId = iCodingRuleManager.getCurrentAppOUID(getDataObject());

				if ((!strOrgId.equalsIgnoreCase(bizOrgUnitID)) || (this.orgNumber == null)) {
					CodingRuleInfo cr = iCodingRuleManager.getCodingRule(this.editData, bizOrgUnitID);

					if ((cr == null) || (!cr.isOrgFirst()) || (!this.isAddView))
						;
				} else if (this.isAddView) {
					getNumTextField().setText(this.orgNumber);
					this.editData.setNumber(this.orgNumber);
					initOldData(this.editData);
				}

			}

			if (this.isAutoNumber) {
				this.isModifiable = isModifiable(bizOrgUnitID);
				if (this.isModifiable) {
					if (("VIEW".equals(getOprtState())) || ("FINDVIEW".equals(getOprtState()))) {
						getNumTextField().setEditable(false);

						getNumTextField().setAccessAuthority(1);
						this.isEditable = false;
					} else {
						getNumTextField().setEditable(true);
						getNumTextField().setAccessAuthority(0);
						getNumTextField().setEnabled(true);
						this.isEditable = true;
					}
					getNumTextField().requestFocus();
				} else {
					getNumTextField().setEditable(false);

					getNumTextField().setAccessAuthority(1);
					this.isEditable = false;
				}
			} else {
				if (("VIEW".equals(getOprtState())) || ("FINDVIEW".equals(getOprtState()))) {
					getNumTextField().setEditable(false);

					getNumTextField().setAccessAuthority(1);
					this.isEditable = false;
				} else {
					getNumTextField().setEditable(true);
					getNumTextField().setAccessAuthority(0);
					getNumTextField().setEnabled(true);
					this.isEditable = true;
				}
				getNumTextField().requestFocus();
			}
		} catch (Exception e) {
			handUIException(e);
		}
	}

	/** @deprecated */
	public String readNewNumber() throws CodingRuleException, EASBizException, BOSException {
		ICodingRuleManager iCodingRuleManager = CodingRuleManagerFactory.getRemoteInstance();

		String strCompanyID = iCodingRuleManager.getCurrentAppOUID(getDataObject());

		if ((getBindingProperty() != null) && (getBindingProperty().trim().length() > 0)) {
			return iCodingRuleManager.readNumber(this.editData, strCompanyID, getBindingProperty());
		}

		return iCodingRuleManager.readNumber(this.editData, strCompanyID);
	}

	/** @deprecated */
	public String getNewNumber() throws CodingRuleException, EASBizException, BOSException {
		ICodingRuleManager iCodingRuleManager = CodingRuleManagerFactory.getRemoteInstance();

		String strCompanyID = iCodingRuleManager.getCurrentAppOUID(getDataObject());

		if ((getBindingProperty() != null) && (getBindingProperty().trim().length() > 0)) {
			this.orgNumber = iCodingRuleManager.getNumber(this.editData, strCompanyID, getBindingProperty());

			return this.orgNumber;
		}
		this.orgNumber = iCodingRuleManager.getNumber(this.editData, strCompanyID);
		return this.orgNumber;
	}

	public String getNewNumber(String bizOrgUnitID) throws CodingRuleException, EASBizException, BOSException {
		ICodingRuleManager iCodingRuleManager = CodingRuleManagerFactory.getRemoteInstance();

		if (this.editData.getCU() == null) {
			this.editData.setCU(getMainOrgInfo().getCU());
		}
		if ((getBindingProperty() != null) && (getBindingProperty().trim().length() > 0)) {
			return iCodingRuleManager.getNumber(this.editData, bizOrgUnitID, getBindingProperty());
		}

		return iCodingRuleManager.getNumber(this.editData, bizOrgUnitID);
	}

	public String getNewNumberByUnit(String bizOrgUnitID) throws Exception {
		ICodingRuleManager iCodingRuleManager = CodingRuleManagerFactory.getRemoteInstance();

		if (this.editData.getCU() == null) {
			this.editData.setCU(getMainOrgInfo().getCU());
		}
		if ((getBindingProperty() != null) && (getBindingProperty().trim().length() > 0)) {
			return iCodingRuleManager.getNumber(this.editData, bizOrgUnitID, getBindingProperty());
		}

		return iCodingRuleManager.getNumber(this.editData, bizOrgUnitID);
	}

	public void rolbackNumber(SCMBillBaseInfo aSCMBillBaseInfo, String bizOrgUnitID) throws Exception {
		ICodingRuleManager iCodingRuleManager = CodingRuleManagerFactory.getRemoteInstance();

		String strBindProp = getBindingProperty();
		if ((strBindProp != null) && (strBindProp.trim().length() > 0)) {
			if (iCodingRuleManager.isUseIntermitNumber(aSCMBillBaseInfo, bizOrgUnitID, strBindProp)) {
				iCodingRuleManager.recycleNumber(aSCMBillBaseInfo, bizOrgUnitID, strBindProp, "", aSCMBillBaseInfo.getNumber());
			}

		} else if (iCodingRuleManager.isUseIntermitNumber(aSCMBillBaseInfo, bizOrgUnitID)) {
			iCodingRuleManager.recycleNumber(aSCMBillBaseInfo, bizOrgUnitID, aSCMBillBaseInfo.getNumber());
		}
	}

	public boolean isAddView() throws CodingRuleException, EASBizException, BOSException {
		return this.ruleStatus != null ? this.ruleStatus.isAddView() : false;
	}

	public boolean isAddView(String bizOrgUnitID) throws CodingRuleException, EASBizException, BOSException {
		return this.ruleStatus != null ? this.ruleStatus.isAddView() : false;
	}

	protected boolean isAutoNumber() throws Exception {
		return this.ruleStatus != null ? this.ruleStatus.isExist() : false;
	}

	protected boolean isAutoNumber(String bizOrgUnitID) throws Exception {
		return this.ruleStatus != null ? this.ruleStatus.isExist() : false;
	}

	protected boolean isModifiable() throws Exception {
		return this.ruleStatus != null ? this.ruleStatus.isModifiable() : false;
	}

	protected boolean isModifiable(String bizOrgUnitID) throws Exception {
		return this.ruleStatus != null ? this.ruleStatus.isModifiable() : false;
	}

	protected void beforeStoreFields(ActionEvent e) throws Exception {
		if (getNumTextField() == null)
			return;
	}

	protected IObjectValue createNewData() {
		return null;
	}

	protected IObjectValue createNewDetailData(KDTable table) {
		return null;
	}

	protected ICoreBase getBizInterface() throws Exception {
		return null;
	}

	protected KDTable getDetailTable() {
		return null;
	}

	protected void unLockUI() {
		super.unLockUI();
	}

	protected void initDataStatus() {
		super.initDataStatus();
		setUnVisibleField();
		setStatus();

		if (getMainOrgUnit() != null)
			if ((this.editData != null) && ((this.editData.getId() != null) || (isBotpBill())) && (getMainOrgUnit().getValue() != null)) {
				getMainOrgUnit().setAccessAuthority(1);

				getMainOrgUnit().setEditable(false);
			} else {
				getMainOrgUnit().setAccessAuthority(0);

				getMainOrgUnit().setEditable(true);
			}
	}

	public void setOprtState(String oprtType) {
		super.setOprtState(oprtType);
	}

	public void setStatus() {
		this.actionTraceUp.setEnabled(true);
		this.btnTraceUp.setEnabled(true);
		this.menuItemTraceUp.setEnabled(true);
		this.actionTraceDown.setEnabled(true);
		this.btnTraceDown.setEnabled(true);
		this.menuItemTraceDown.setEnabled(true);

		setQueryByMaterialStatus(true);

		setQueryGeneralInventoryStatus(true);

		setMaterialViewStatus(true);

		if (isSplitLine()) {
			if ((this.editData == null) || (((this.editData instanceof InvBillBaseInfo)) && (((InvBillBaseInfo) this.editData).isIsReversed()))) {
				setSplitLineEnable(false);
			} else
				setSplitLineEnable(true);

		}

		SCMBillBaseInfo info = (SCMBillBaseInfo) this.dataBinder.getValueObject();
		if ("ADDNEW".equals(getOprtState())) {
			this.actionSave.setEnabled(true);
			this.actionSubmit.setEnabled(true);

			this.actionTraceUp.setEnabled(false);
			this.menuItemTraceUp.setEnabled(false);
			this.actionTraceDown.setEnabled(false);
			this.menuItemTraceDown.setEnabled(false);

			if (isBotpBill()) {
				setAddLineStatus(false);
			} else {
				setAddLineStatus(true);
			}
			setRemoveLineStatus(true);

			setCreateFromStatus(true);

			setAuditStatus(false);

			setUnAuditStatus(false);

			this.btnCopy.setEnabled(false);
			this.btnRemove.setEnabled(false);
			this.menuItemCopy.setEnabled(false);
			this.menuItemRemove.setEnabled(false);

			getDetailTable().setEditable(true);
		} else if (("VIEW".equals(getOprtState())) || ("FINDVIEW".equals(getOprtState()))) {
			this.btnSplitLine.setEnabled(false);
			this.menuItemSplitLine.setEnabled(false);

			this.menuItemSplitOption.setEnabled(false);

			if (getNumTextField() != null) {
				getNumTextField().setEditable(false);
			}

			setAddLineStatus(false);
			setRemoveLineStatus(false);

			setCreateFromStatus(false);

			if ((info.getBaseStatus() != null) && (info.getBaseStatus() == BillBaseStatusEnum.SUBMITED)) {
				if ("FINDVIEW".equals(getOprtState()))
					setAuditStatus(false);
				else
					setAuditStatus(true);
			} else {
				setAuditStatus(false);
			}

			if ((info.getBaseStatus() != null) && (info.getBaseStatus() == BillBaseStatusEnum.AUDITED)) {
				if ("FINDVIEW".equals(getOprtState()))
					setUnAuditStatus(false);
				else
					setUnAuditStatus(true);
			} else {
				setUnAuditStatus(false);
			}
			if ("FINDVIEW".equals(getOprtState())) {
				this.btnCopy.setEnabled(false);
				this.btnRemove.setEnabled(false);
				this.menuItemCopy.setEnabled(false);
				this.menuItemRemove.setEnabled(false);
			} else {
				this.btnCopy.setEnabled(true);
				this.btnRemove.setEnabled(true);
				this.menuItemCopy.setEnabled(true);
				this.menuItemRemove.setEnabled(true);
			}

			getDetailTable().setEditable(false);
		} else if ("EDIT".equals(getOprtState())) {
			this.actionSave.setEnabled(true);
			this.actionSubmit.setEnabled(true);

			if (isBotpBill()) {
				setAddLineStatus(false);
			} else {
				setAddLineStatus(true);
			}
			setRemoveLineStatus(true);

			setCreateFromStatus(true);

			if ((info.getBaseStatus() != null) && (info.getBaseStatus() == BillBaseStatusEnum.SUBMITED)) {
				setAuditStatus(true);
			} else
				setAuditStatus(false);

			if ((info.getBaseStatus() != null) && (info.getBaseStatus() == BillBaseStatusEnum.AUDITED)) {
				setUnAuditStatus(true);
			} else
				setUnAuditStatus(false);

			this.btnCopy.setEnabled(true);
			this.btnRemove.setEnabled(true);
			this.menuItemCopy.setEnabled(true);
			this.menuItemRemove.setEnabled(true);

			getDetailTable().setEditable(true);
		}
	}

	protected void setAddLineStatus(boolean status) {
		this.actionAddLine.setEnabled(status);
		this.actionInsertLine.setEnabled(status);

		this.menuItemAddLine.setEnabled(status);
		this.menuItemInsertLine.setEnabled(status);

		this.btnAddLine.setEnabled(status);
		this.btnInsertLine.setEnabled(status);

		if (status) {
			initTableKeyStroke(getDetailTable(), true);
		} else if ((!this.btnAddLine.isEnabled()) && (!this.btnInsertLine.isEnabled())) {
			KDTableHelper.updateEnterWithTab(getDetailTable(), false, null);
			KDTableHelper.downArrowAutoAddRow(getDetailTable(), false, null);
		}
	}

	protected void setRemoveLineStatus(boolean status) {
		this.actionRemoveLine.setEnabled(status);
		this.menuItemRemoveLine.setEnabled(status);
		this.btnRemoveLine.setEnabled(status);
	}

	protected void setCreateFromStatus(boolean status) {
		this.actionCreateFrom.setEnabled(status);
		this.menuItemCreateFrom.setEnabled(status);
		this.btnCreateFrom.setEnabled(status);
	}

	protected void setAuditStatus(boolean status) {
		this.actionAudit.setEnabled(status);
		this.menuItemAudit.setEnabled(status);
		this.btnAudit.setEnabled(status);
	}

	protected void setUnAuditStatus(boolean status) {
		this.actionUnAudit.setEnabled(status);
		this.menuItemUnAudit.setEnabled(status);
		this.btnUnAudit.setEnabled(status);
	}

	protected void setQueryByMaterialStatus(boolean status) {
		this.actionQueryByMaterial.setEnabled(status);
		this.menuItemQueryByMaterial.setEnabled(status);
		this.btnQueryByMaterial.setEnabled(status);
	}

	protected void setQueryGeneralInventoryStatus(boolean status) {
		this.actionQueryGeneralInventory.setEnabled(status);
		this.menuItemQueryGeneralInventory.setEnabled(status);
		this.btnQueryGeneralInventory.setEnabled(status);
	}

	protected void setSplitLineEnable(boolean isEnable) {
		this.btnSplitLine.setEnabled(isEnable);
		this.menuItemSplitLine.setEnabled(isEnable);

		this.menuItemSplitOption.setEnabled(isEnable);
		this.actionSplitOption.setEnabled(isEnable);
		this.actionSplitLine.setEnabled(isEnable);
	}

	protected void setDecomposeEnable(boolean isEnable) {
		this.btnDecompose.setEnabled(isEnable);
		this.menuItemDecompose.setEnabled(isEnable);
	}

	protected void setMaterialViewStatus(boolean status) {
		this.actionMaterialView.setEnabled(status);
		this.menuItemMaterialView.setEnabled(status);
		this.btnMaterialView.setEnabled(status);
	}

	protected boolean isBotpBill() {
		if (this.editData == null) {
			return false;
		}
		BillTypeInfo billType = this.editData.getSourceBillType();

		return billType != null;
	}

	protected boolean isBotpBill(String billTypeID) {
		if (isBotpBill()) {
			return this.editData.getSourceBillType().getId().toString().equals(billTypeID);
		}

		return false;
	}

	protected void registeUnVisibleField(KDLabelContainer[] conts) {
		this.conts = conts;
	}

	protected void setUnVisibleField() {
		if (this.conts != null) {
			int i = 0;
			for (int num = this.conts.length; i < num; i++)
				this.conts[i].setEnabled(false);
		}
	}

	protected void assignSelector(KDPromptBox promptBox, KDPromptSelector selector) {
		promptBox.setSelector(selector);
	}

	public void actionRemoveLine_actionPerformed(ActionEvent e) throws Exception {
		if (getDetailTable().getSelectManager().size() == 0) {
			MsgBox.showInfo(this, EASResource.getString("com.kingdee.eas.framework.FrameWorkResource.Msg_NoneEntry"));

			return;
		}

		if (isBillTotalRow()) {
			if (getDetailTable().getSelectManager().size() > 0) {
				int top = getDetailTable().getSelectManager().get().getTop();
				IRow row = getDetailTable().getRow(top);
				if (SCMClientHelper.checkIsTotalLine(row))
					return;
			} else {
				return;
			}

		}

		super.actionRemoveLine_actionPerformed(e);
		if (isBillTotalRow())
			setTotalRow();
	}

	protected boolean confirmRemove() {
		return MsgBox.isYes(MsgBox.showConfirm2(this, EASResource.getString("com.kingdee.eas.framework.FrameWorkResource.Confirm_Delete")));
	}

	protected String getClassAlise() {
		String className = FrameWorkUtils.getClassAlias(this.editData);

		String strCode = EASResource.getString("com.kingdee.eas.common.EASCommonResource.code");

		String number = "";
		if (this.editData.getNumber() != null) {
			number = this.editData.getNumber();
		}
		className = className + " " + strCode + ": " + number;
		return className;
	}

	public boolean isModify() {
		if (("VIEW".equals(getOprtState())) || ("FINDVIEW".equals(getOprtState()))) {
			return false;
		}
		SCMBillBaseInfo billInfo = this.editData;
		if ((billInfo != null) && (billInfo.getBaseStatus() != null) && (billInfo.getBaseStatus().equals(BillBaseStatusEnum.AUDITED))) {
			if (getUIContext().get("BillQuery") == null) {
				return false;
			}
		}
		return super.isModify();
	}

	public void actionEdit_actionPerformed(ActionEvent e) throws Exception {
		if (getOprtState().equals("VIEW")) {
			checkCanEdit();
		}

		super.actionEdit_actionPerformed(e);

		CoreBaseInfo info = (CoreBaseInfo) getMainOrgUnit().getData();
		if ((info != null) && (info.getId() != null)) {
			String infoID = info.getId().toString();
			setNumEditableWhenUnitChange(infoID);
		}
	}

	public void actionAddNew_actionPerformed(ActionEvent e) throws Exception {
		clearBotpViewInContext();
		super.actionAddNew_actionPerformed(e);

		this.editData.setSyncOldValue(true);

		if (!this.isAutoNumber) {
			if (("VIEW".equals(getOprtState())) || ("FINDVIEW".equals(getOprtState()))) {
				getNumTextField().setEditable(false);

				getNumTextField().setAccessAuthority(1);
				this.isEditable = false;
			} else {
				getNumTextField().setEditable(true);
				getNumTextField().setAccessAuthority(0);
				getNumTextField().setEnabled(true);
				this.isEditable = true;
				getNumTextField().requestFocus();
			}

		}

		if (getMainOrgUnit() != null) {
			getMainOrgUnit().setReadOnly(false);
			getMainOrgUnit().setAccessAuthority(0);

			getMainOrgUnit().setEditable(true);
		}

		setMakeRelations(null);

		setMainBizOrgF7(getMainBizOrg(), getMainBizOrgType());

		if (getMainOrgContext() != null) {
			OrgUnitInfo orgUnitInfo = (OrgUnitInfo) getMainOrgContext().get(getMainBizOrgType());

			if (orgUnitInfo != null) {
				afterMainOrgChanged(null, orgUnitInfo.getId().toString());
			}
		}

		this.editData.setSyncOldValue(false);
	}

	public void actionRemove_actionPerformed(ActionEvent e) throws Exception {
		super.actionRemove_actionPerformed(e);

		if ("ADDNEW".equals(getOprtState())) {
			OrgUnitInfo orgUnitInfo = (OrgUnitInfo) getMainOrgUnit().getData();
			if ((orgUnitInfo != null) && (orgUnitInfo.getId() != null)) {
				String orgId = orgUnitInfo.getId().toString();
				this.isAutoNumber = isAutoNumber(orgId);

				if (this.isAutoNumber) {
					this.isAddView = isAddView(orgId);

					if ((this.isAddView) && ((null == getNumTextField().getText()) || ("".equals(getNumTextField().getText().trim())))) {
						String newNum = getNewNumberByUnit(orgId);
						getNumTextField().setText(newNum);
						this.editData.setNumber(newNum);
						initOldData(this.editData);
					}
				}

				setNumEditableWhenUnitChange(orgId);
			}
		}
	}

	public void actionCopy_actionPerformed(ActionEvent e) throws Exception {
		if (this.editData.getSourceBillType() != null) {
			MsgBox.showError(this, SCMClientUtils.getResource("CANT_COPY_BOTPBILL"));

			this.actionCopy.setEnabled(false);
			SysUtil.abort();
		}

		this.isCoay = true;
		super.actionCopy_actionPerformed(e);

		OrgUnitInfo orgUnitInfo = (OrgUnitInfo) getMainBizOrg().getValue();
		if (orgUnitInfo != null) {
			loadSCMBizData();
			changeF7Context();
			setNumWhereCopy();
			if (!this.isEditable)
				getNumTextField().setAccessAuthority(1);
			else {
				getNumTextField().setEnabled(this.isEditable);
			}
		}

		setMainBizOrgF7(getMainBizOrg(), getMainBizOrgType());

		this.isCoay = false;
	}

	protected void checkCanEdit() throws Exception {
		if ((this.editData == null) || (this.editData.getId() == null)) {
			SysUtil.abort();
		} else {
			BillBaseStatusEnum baseStatus = this.editData.getBaseStatus();
			if (baseStatus != null) {
				int baseStatusValue = baseStatus.getValue();

				if ((baseStatusValue != 0) && (baseStatusValue != 1) && (baseStatusValue != 2)) {
					MsgBox.showError(this, SCMClientUtils.getResource("BillAt") + baseStatus.getAlias() + SCMClientUtils.getResource("CantBeEdited"));
					SysUtil.abort();
				}
			}
		}
	}

	protected void confirmChangeBizOrgUnit(KDBizPromptBox prmtBizOrg, String materialFieldName) {
		final String fieldName = materialFieldName;
		if (!this.listenerMap.containsKey(prmtBizOrg)) {
			PreChangeListener prmtBizOrgPreChangeListener = new PreChangeListener() {
				private final String val$fieldName = fieldName;

				public void preChange(PreChangeEvent arg0) {
					if ((SCMBillEditUI.this.skipCheckBizorgUnitChange(arg0)) || (!SCMBillEditUI.this.isNeedCheckBizorgUnitChange)) {
						return;
					}
					if ((arg0.getData() != null) && (arg0.getData().equals(arg0.getOldData()))) {
						return;
					}
					String strTemp = null;
					if (!SCMBillEditUI.this.checkCanChangeBizOrg()) {
						arg0.setResult(0);
						return;
					}

					if (!SCMBillEditUI.this.isBotpBill()) {
						if ((!SCMClientUtils.checkEntryIsBlank(SCMBillEditUI.this.getDetailTable(), this.val$fieldName)) && (arg0.getOldData() != null)) {
							strTemp = SCMClientUtils.getResource("CLEARENTRYAFTERORGCHANGED");

							int ret = MsgBox.showConfirm2(strTemp);
							if (ret == 2) {
								arg0.setResult(0);
								return;
							}

							if (!SCMBillEditUI.this.isBotpBill()) {
								SCMBillEditUI.this.cleanEntry();

								if (SCMBillEditUI.this.getDetailTable() != null) {
									SCMBillEditUI.this.addLine(SCMBillEditUI.this.getDetailTable());
								}
							}

						}

					} else {
						SCMBillEditUI.this.checkPurOrgUnitForStorageOrgUnit();
					}

					SCMBillEditUI.this.afterConfirmChangeBizOrgUnit();
				}
			};
			this.listenerMap.put(prmtBizOrg, prmtBizOrgPreChangeListener);
			prmtBizOrg.addPreChangeListener(prmtBizOrgPreChangeListener);
		}
	}

	protected void cleanEntry() {
		for (int i = getDetailTable().getRowCount() - 1; i >= 0; i--)
			removeLine(getDetailTable(), i);
	}

	protected void checkPurOrgUnitForStorageOrgUnit() {
	}

	protected void removeLine(KDTable table, int rowIndex) {
		if (table == null) {
			return;
		}

		if (table.getRow(rowIndex) != null) {
			table.getSelectManager().select(rowIndex, 0, rowIndex, 0, 2);

			IObjectValue detailData = (IObjectValue) table.getRow(rowIndex).getUserObject();

			beforeRemoveLine(table, detailData);

			table.removeRow(rowIndex);
			IObjectCollection collection = (IObjectCollection) table.getUserObject();

			if (collection == null) {
				logger.error("collection not be binded to table");
			} else if (detailData != null) {
				collection.removeObject(detailData);
			}

			afterRemoveLine(table, detailData);
		}
	}

	protected void isNeedCheckBizorgUnitChange(boolean isNeedCheck) {
		this.isNeedCheckBizorgUnitChange = isNeedCheck;
	}

	protected boolean skipCheckBizorgUnitChange(PreChangeEvent arg0) {
		return false;
	}

	protected boolean checkCanChangeBizOrg() {
		return true;
	}

	protected void afterConfirmChangeBizOrgUnit() {
	}

	public boolean isNeedShowBOTPRule() {
		return true;
	}

	protected void insertLine(int row) {
		KDTable kdtEntries = getDetailTable();
		if (kdtEntries == null) {
			return;
		}
		IObjectValue detailData = createNewDetailData(kdtEntries);
		IRow irow = null;
		irow = kdtEntries.addRow(row);
		loadLineFields(kdtEntries, irow, detailData);
		afterInsertLine(kdtEntries, detailData);
	}

	protected void registerDealMultiMateiralInfo(KDBizPromptBox promptBox, final String fieldName) {
		this.prmtMaterialListener = new DataChangeListener() {

			public void dataChanged(DataChangeEvent e) {
				SCMBillEditUI.this.materialChanged(fieldName, e);
			}
		};
		promptBox.addDataChangeListener(this.prmtMaterialListener);
	}

	protected void doMaterialChanged(KDBizPromptBox bizMaterialBox, MaterialInfo[] materialInfos, int selectedRow, String materialFieldname) throws Exception {
		Map dataMap = new HashMap();
		materialInfos = verifyMaterials(materialInfos, selectedRow, dataMap, materialFieldname);

		if ((materialInfos == null) || (materialInfos.length == 0)) {
			bizMaterialBox.setValue(null);
			return;
		}

		KDTable table = getDetailTable();
		HashMap beforeExceptionMap = new HashMap();
		HashMap afterExceptionMap = new HashMap();
		KDTSelectBlock ksb = table.getSelectManager().get();
		int beginRow = ksb.getBeginRow();
		IRow curRow = table.getRow(beginRow);
		int curCol = table.getColumnIndex(materialFieldname);
		bizMaterialBox.removeDataChangeListener(this.prmtMaterialListener);

		int length = materialInfos.length;
		if (length > 0) {
			IRow curRow2 = null;
			MaterialInfo mi = null;
			boolean needInsert = false;
			int insertedRowCount = 0;
			for (int i = 0; i < length; i++) {
				if (needInsert) {
					insertLine(beginRow + insertedRowCount);
					needInsert = false;
				}

				mi = materialInfos[i];
				curRow2 = table.getRow(beginRow + insertedRowCount);

				if (materialInfos[i] == null) {
					curRow2.getCell(curCol).setValue(mi);
					curRow2.getCell(curCol).setValue(null);
					return;
				}
				curRow2.getCell(curCol).setValue(null);
				try {
					beforeInsertMaterialInfo(mi);
					curRow2.getCell(curCol).setValue(mi);
				} catch (Exception ex) {
					curRow2.getCell(curCol).setValue(mi);
					curRow2.getCell(curCol).setValue(null);
					beforeExceptionMap.put(mi, ex);
				} finally {
				}
				try {
					afterInsertMaterialInfo(beginRow + insertedRowCount);
				} catch (Exception ex) {
					afterExceptionMap.put(mi, ex);
				}

				needInsert = true;
				insertedRowCount++;
			}

			if ((!needInsert) && (insertedRowCount > 0)) {
				removeLine(table, beginRow + insertedRowCount);
			}

			if ((beforeExceptionMap != null) && (beforeExceptionMap.size() > 0)) {
				handleBeforeInsertRowException(beforeExceptionMap);
			}
			if ((afterExceptionMap != null) && (afterExceptionMap.size() > 0)) {
				handleAfterInsertRowException(afterExceptionMap);
			}

			afterInsertMaterials(beginRow, materialInfos, dataMap);
		} else {
			curRow.getCell(curCol).setValue(new MaterialInfo());
			curRow.getCell(curCol).setValue(null);
			afterInsertMaterialInfo(beginRow);
		}

		bizMaterialBox.addDataChangeListener(this.prmtMaterialListener);
	}

	protected void materialChanged(final String materialFieldname, DataChangeEvent e) {
		try {
			final KDBizPromptBox bizMaterialBox = (KDBizPromptBox) e.getSource();

			KDTable tb = getDetailTable();
			KDTSelectBlock selected = tb.getSelectManager().get();
			if (selected == null)
				return;
			final int selectedRow = selected.getBeginRow();

			if (bizMaterialBox.getValue() == null) {
				clearWhenMaterialCleared(selectedRow);
				return;
			}
			MaterialInfo[] materialInfos = null;

			if ((bizMaterialBox.getValue() instanceof MaterialInfo[])) {
				materialInfos = (MaterialInfo[]) bizMaterialBox.getValue();
			} else if ((bizMaterialBox.getValue() instanceof MaterialInfo)) {
				materialInfos = new MaterialInfo[] { (MaterialInfo) bizMaterialBox.getValue() };

				if (selected != null) {
					if (selectedRow >= 0) {
						ICell cell = tb.getRow(selectedRow).getCell(materialFieldname);

						if (cell != null) {
							Object o = cell.getValue();
							if ((o != null) && ((o instanceof MaterialInfo))
									&& (materialInfos[0].getId().toString().equals(((MaterialInfo) o).getId().toString()))) {
								return;
							}
						}
					}
				}
			} else if ((bizMaterialBox.getValue() instanceof Object[])) {
				Object[] objects = (Object[]) bizMaterialBox.getValue();
				if (objects.length == 0)
					return;
				materialInfos = new MaterialInfo[objects.length];
				System.arraycopy(objects, 0, materialInfos, 0, objects.length);
			} else {
				return;
			}

			if (materialInfos.length >= 5) {
				LongtimeIndicator waiting = new LongtimeIndicator();
				final MaterialInfo[] materialInfosFinal = materialInfos;
				waiting.letMeDo(new ILongTimeTask() {
					private final KDBizPromptBox val$bizMaterialBox = bizMaterialBox;
					private final MaterialInfo[] val$materialInfosFinal = materialInfosFinal;
					private final int val$selectedRow = selectedRow;
					private final String val$materialFieldname = materialFieldname;

					public Object exec() throws Exception {
						RPCInvokeCounter.startActionCount(SCMBillEditUI.this.getMetaDataPK().getFullName(), EASResource.getString(
								"com.kingdee.eas.scm.common.SCM_COMMONResource", "MaterialChoose"));

						LowTimer timer = new LowTimer();
						SCMBillEditUI.this.doMaterialChanged(this.val$bizMaterialBox, this.val$materialInfosFinal, this.val$selectedRow,
								this.val$materialFieldname);

						RPCInvokeCounter.endActionCount(SCMBillEditUI.this.getMetaDataPK().getFullName(), EASResource.getString(
								"com.kingdee.eas.scm.common.SCM_COMMONResource", "MaterialChoose"), timer.msValue());

						return new Boolean(true);
					}

					public void afterExec(Object result) throws Exception {
					}
				});
				waiting.doJob();
			} else {
				doMaterialChanged(bizMaterialBox, materialInfos, selectedRow, materialFieldname);
			}
		} catch (Exception exc) {
			handUIException(exc);
		} finally {
		}
	}

	protected void showExceptionMessage(HashMap exceptionMap) {
		if ((exceptionMap != null) && (exceptionMap.size() > 0)) {
			StringBuffer exMsg = new StringBuffer();
			Iterator keyIt = exceptionMap.keySet().iterator();
			MaterialInfo materialInfo = null;
			Exception ex = null;
			boolean isFirst = true;
			while (keyIt.hasNext()) {
				if (!isFirst)
					exMsg.append("\n");
				else {
					isFirst = false;
				}
				materialInfo = (MaterialInfo) keyIt.next();
				ex = (Exception) exceptionMap.get(materialInfo);
				exMsg.append(materialInfo.getName()).append(":").append(ex.getMessage());
			}

			if (exMsg.length() > 0)
				MsgBox.showInfo(exMsg.toString());
		}
	}

	protected void handleAfterInsertRowException(HashMap afterExceptionMap) {
		showExceptionMessage(afterExceptionMap);
	}

	protected void handleBeforeInsertRowException(HashMap beforeExceptionMap) {
		showExceptionMessage(beforeExceptionMap);
	}

	/** @deprecated */
	protected void beforeInsertMaterialInfo(MaterialInfo materialInfo) throws Exception {
	}

	protected boolean isDecompose() {
		return false;
	}

	protected void setDecompose(TransactionTypeInfo transTypeInfo) {
		if ((isDecompose()) && (!this.editData.getBaseStatus().equals(BillBaseStatusEnum.AUDITED))) {
			if ((transTypeInfo != null) && ((transTypeInfo.getExistingQty().getValue() == -1) || (transTypeInfo.getExistingQtyPre().getValue() == -1))) {
				this.actionDecompose.setEnabled(true);
				this.btnDecompose.setVisible(true);
				this.menuItemDecompose.setVisible(true);
				return;
			}
		}

		this.actionDecompose.setEnabled(false);
		this.btnDecompose.setVisible(false);
		this.menuItemDecompose.setVisible(false);
	}

	protected TransactionTypeInfo getTransactionType() {
		return null;
	}

	protected AdminOrgUnitInfo getAdminOrgUnit() throws Exception {
		return null;
	}

	protected StorageOrgUnitInfo getStorageOrgUnit() throws Exception {
		return null;
	}

	public void actionDecompose_actionPerformed(ActionEvent e) throws Exception {
		if ((this.editData == null) || (this.editData.getBillType() == null) || (getTransactionType() == null)) {
			return;
		}

		IObjectCollection entrys = (IObjectCollection) this.editData.get("entry");
		if ((entrys == null) || (entrys.size() == 0)) {
			return;
		}

		for (int i = 0; i < entrys.size(); i++) {
			SCMBillEntryBaseInfo entry = (SCMBillEntryBaseInfo) entrys.getObject(i);

			if (entry.getMaterial() == null) {
				MsgBox.showInfo(this, SCMClientUtils.getResource("MATERIAL_CANT_BE_NULL"));

				SysUtil.abort();
			}
		}

		if ((this.editData.getBaseStatus().equals(BillBaseStatusEnum.ADD)) || (this.editData.getId() == null)) {
			MsgBox.showInfo(this, InvClientUtils.getResource("NODECOMPOSE"));
			SysUtil.abort();
		}
		Boolean isReversed = (Boolean) this.editData.get("isReversed");
		if ((isReversed != null) && (Boolean.TRUE.equals(isReversed))) {
			MsgBox.showInfo(this, InvClientUtils.getResource("NODECOMPOSE_REVERSED"));
			SysUtil.abort();
		}

		IInventoryUpdate iiu = InventoryUpdateFactory.getRemoteInstance();
		HashMap hm = iiu.getDecomposePara(this.editData.getId().toString(), getTransactionType().getId().toString());

		if (((ArrayList) hm.get("InventoryIDList")).size() > 0) {
			BuildDecomposeBill bdb = new BuildDecomposeBill();

			bdb.setBillTypeInfo(this.editData.getBillType());

			bdb.setBillID(this.editData.getId().toString());

			bdb.setStorageOrgInfo(getStorageOrgUnit());

			bdb.setAdminOrgInfo(getAdminOrgUnit());
			bdb.setInventorys(hm);
			bdb.showNewDecompBill(this);
		} else {
			MsgBox.showInfo(this, InvClientUtils.getResource("NOTCANBEDECOMPOSE"));

			SysUtil.abort();
		}
	}

	/** @deprecated */
	protected void afterInsertMaterialInfo(int rowIndex) throws Exception {
	}

	protected void afterInsertMaterials(int rowIdx, MaterialInfo[] materialInfos, Map dataMap) throws Exception {
		if (materialInfos.length > 1)
			setDefaultValueOnColumn(rowIdx + 1, materialInfos.length - 1);
	}

	public void actionSave_actionPerformed(ActionEvent e) throws Exception {
		this.editData.setBotpCallSave(false);

		clearBotpViewInContext();
		super.actionSave_actionPerformed(e);
	}

	public void actionSubmit_actionPerformed(ActionEvent e) throws Exception {
		clearBotpViewInContext();
		try {
			this.isInSubmiting = true;

			if ((getOprtState().equals("ADDNEW")) || (getOprtState().equals("EDIT"))) {
				if (!this.verifyManager.verify()) {
					SysUtil.abort();
				}

			}

			this.editData.setBotpCallSave(false);

			super.actionSubmit_actionPerformed(e);

			if (BillBaseStatusEnum.AUDITED.equals(this.editData.getBaseStatus())) {
				setOprtState("VIEW");
				lockUIForViewStatus();
			}

		} finally {
			this.isInSubmiting = false;
		}
	}

	public void actionPrint_actionPerformed(ActionEvent e) throws Exception {
		if (this.editData == null) {
			return;
		}

		BillBaseStatusEnum billBaseStatus = this.editData.getBaseStatus();
		if ((this.editData.getId() == null) || ((billBaseStatus != null) && ((billBaseStatus.getValue() == 0) || (billBaseStatus.getValue() == 1)))) {
			MsgBox.showInfo(this, InvClientUtils.getResource("CanPrintAndPrintView"));
			SysUtil.abort();
		}
	}

	public void actionPrintPreview_actionPerformed(ActionEvent e) throws Exception {
		if (this.editData == null) {
			return;
		}

		BillBaseStatusEnum billBaseStatus = this.editData.getBaseStatus();
		if ((this.editData.getId() == null) || ((billBaseStatus != null) && ((billBaseStatus.getValue() == 0) || (billBaseStatus.getValue() == 1)))) {
			MsgBox.showInfo(this, InvClientUtils.getResource("CanPrintAndPrintView"));
			SysUtil.abort();
		}
	}

	protected void invokePrintFunction(boolean isPrint) {
		ArrayList idList = new ArrayList();

		if ((this.editData != null) && (!StringUtils.isEmpty(this.editData.getString("id")))) {
			idList.add(this.editData.getString("id"));
		}

		if ((idList == null) || (idList.size() == 0) || (gettDQueryPKEx() == null) || (getTDFileName() == null)) {
			return;
		}

		MultiDataSourceDataProviderProxy data = new MultiDataSourceDataProviderProxy();

		setCustomerDataProvider(data, idList);

		SCMCommonDataProvider mainQueryData = new SCMCommonDataProvider(idList, gettDQueryPKEx());
		mainQueryData.setFilter(getPrintFilter(idList));
		data.put("MainQuery", mainQueryData);

		MultiapproveDataProvider multiapproveDataSource = new MultiapproveDataProvider(getSelectedIdForPrint(), isShowMultiapproveHistoryForPrint(), "billId");
		multiapproveDataSource.setMultiapproveDataFilter(getMultiapproveDataFilter());
		data.put(getMultiapproveQueryNameForPrint(), multiapproveDataSource);

		KDNoteHelper appHlp = new KDNoteHelper();
		CommonPrintIntegrationDataProvider printQueryData = new CommonPrintIntegrationDataProvider(this.editData.getBOSType().toString(),
				PrintIntegrationManager.getPrintQueryPK());

		data.put("PrintQuery", printQueryData);
		PrintIntegrationManager.initPrint(appHlp, this.editData.getBOSType(), idList, getTDFileName(), "com.kingdee.eas.scm.common.SCMResource", true);

		if (isPrint) {
			appHlp.print(getTDFileName(), data, SwingUtilities.getWindowAncestor(this));
		} else
			appHlp.printPreview(getTDFileName(), data, SwingUtilities.getWindowAncestor(this));
	}

	protected void setCustomerDataProvider(MultiDataSourceDataProviderProxy data, List idList) {
	}

	protected FilterInfo getPrintFilter(List ids) {
		FilterInfo filter = new FilterInfo();
		if (ids.size() == 1) {
			filter.getFilterItems().add(new FilterItemInfo("id", ids.toArray()[0].toString(), CompareType.EQUALS));
		} else {
			filter.getFilterItems().add(new FilterItemInfo("id", new HashSet(ids), CompareType.INCLUDE));
		}
		filter.getFilterItems().add(new FilterItemInfo("baseStatus", new Integer(0), CompareType.NOTEQUALS));
		filter.getFilterItems().add(new FilterItemInfo("baseStatus", new Integer(1), CompareType.NOTEQUALS));
		filter.setMaskString("#0 and #1 and #2");
		return filter;
	}

	protected IMetaDataPK getMultiApproveViewQuery() {
		return new MetaDataPK("com.kingdee.eas.base.multiapprove.app.MultiApproveViewQuery");
	}

	protected IMetaDataPK getTDQueryPK() {
		return null;
	}

	public IMetaDataPK gettDQueryPKEx() {
		if (this.tDQueryPKEx != null) {
			return this.tDQueryPKEx;
		}
		return getTDQueryPK();
	}

	public void settDQueryPKEx(IMetaDataPK tDQueryPKEx) {
		this.tDQueryPKEx = tDQueryPKEx;
	}

	protected String getTDFileName() {
		return null;
	}

	public int getBtpCreateFromType() {
		return 1;
	}

	public void setEditable(boolean isEditable) {
		this.isEditable = isEditable;
	}

	protected Vector getCheckDupFileds() {
		return null;
	}

	protected void checkDupRecord(int curRow, int curCol) {
		if (this.isSpliting) {
			return;
		}
		KDTable kdTable = getDetailTable();

		int rows = kdTable.getRowCount();
		IRow iCurRow = kdTable.getRow(curRow);

		if ((rows <= 1) || (iCurRow == null)) {
			return;
		}

		IRow iRow = null;

		Vector vctFields = getCheckDupFileds();
		int fields = vctFields.size();

		boolean isDuplicate = true;
		boolean isLock = false;

		String colName = null;

		for (int h = 0; h < fields; h++) {
			colName = vctFields.get(h).toString();

			isLock = !iCurRow.getCell(colName).getStyleAttributes().isLocked();
			if ((isLock) && (iCurRow.getCell(colName).getValue() == null)) {
				return;
			}
		}
		MaterialInfo materialInfo = null;
		MaterialInfo curMaterialInfo = null;
		for (int i = 0; i < rows; i++) {
			iRow = kdTable.getRow(i);
			if (i == curRow) {
				continue;
			}
			for (int j = 0; j < fields; j++) {
				isDuplicate = true;
				colName = vctFields.get(j).toString();

				isLock = !iRow.getCell(colName).getStyleAttributes().isLocked();
				if ((isLock) && (iRow.getCell(colName).getValue() == null)) {
					isDuplicate = false;
					break;
				}

				if (((iRow.getCell(colName).getValue() == null) && (iCurRow.getCell(colName).getValue() != null))
						|| ((iRow.getCell(colName).getValue() != null) && (iCurRow.getCell(colName).getValue() == null))) {
					isDuplicate = false;
					break;
				}
				if ((iRow.getCell(colName).getValue() == null) || (iCurRow.getCell(colName).getValue() == null)
						|| (iRow.getCell(colName).getValue().toString() == null) || (iCurRow.getCell(colName).getValue().toString() == null)) {
					continue;
				}
				if (!iRow.getCell(colName).getValue().toString().equals(iCurRow.getCell(colName).getValue().toString())) {
					isDuplicate = false;
					break;
				}
				if ((colName.equals("materialNum")) || (colName.equals("materialNumber"))) {
					materialInfo = (MaterialInfo) iRow.getCell(colName).getValue();
					curMaterialInfo = (MaterialInfo) iCurRow.getCell(colName).getValue();
					if (!materialInfo.getId().toString().equals(curMaterialInfo.getId().toString())) {
						isDuplicate = false;
						break;
					}
				}

			}

			if ((isDuplicate) && (i != curRow)) {
				String msg1 = EASResource.getString("com.kingdee.eas.scm.common.SCMResource.DUPCURROW");

				String msg2 = EASResource.getString("com.kingdee.eas.scm.common.SCMResource.DUPSELROW");

				MsgBox.showInfo(this, msg1 + String.valueOf(i + 1) + msg2);
			}
		}
	}

	protected boolean isShowAttachmentAction() {
		return false;
	}

	public void setDataObject(IObjectValue dataObject) {
		handleBotpBill(dataObject);
		IObjectValue ov = dataObject;
		this.editData = ((SCMBillBaseInfo) ov);
		if (this.uiHelper != null)
			this.uiHelper.setEditData((SCMBillBaseInfo) ov);
		super.setDataObject(ov);
	}

	protected final boolean isFromBotpNewOrEdit() {
		return (getUIContext().get("BOTPViewStatus") != null)
				&& (("ADDNEW".equals(getOprtState())) || ("EDIT".equals(getOprtState())))
				&& (((getUIContext().get("InitDataObject") != null) && ((getUIContext().get("InitDataObject") instanceof IObjectValue))) || (getUIContext()
						.get("ID") != null));
	}

	private void handleBotpBill(IObjectValue dataObject) {
		if (isFromBotpNewOrEdit()) {
			CoreBillBaseInfo billInfo = (CoreBillBaseInfo) dataObject;

			String mainOrgProp = billInfo.getBizOrgPropertyName();
			if ((mainOrgProp != null) && (getMainBizOrg().getData() != null)) {
				try {
					String methodName = getSetMethod(mainOrgProp);
					String number = getNumTextField().getText();

					Method[] methods = billInfo.getClass().getMethods();
					if ((methods != null) && (methods.length > 0)) {
						for (int i = 0; i < methods.length; i++) {
							if (methods[i].getName().equals(methodName)) {
								methods[i].invoke(billInfo, new Object[] { getMainBizOrg().getData() });

								break;
							}
						}

					}

					initUIMainOrgContext(((OrgUnitInfo) getMainBizOrg().getData()).getId().toString());
				} catch (Exception e) {
					handleException(e);
				}
			}

			applyBillDefaultValue(billInfo);
		} else if ("ADDNEW".equals(getOprtState())) {
			applyBillDefaultValue(dataObject);
		}
	}

	public void actionAttachment_actionPerformed(ActionEvent e) throws Exception {
		AttachmentClientManager acm = AttachmentManagerFactory.getClientManager();

		String boID = getSelectBOID();
		if (boID == null) {
			MsgBox.showInfo(this, EASResource.getString("com.kingdee.eas.scm.common.SCMResource", "ATTACHMENT_NO_BID"));
			return;
		}

		boolean isEdit = false;
		if ("EDIT".equals(getOprtState())) {
			isEdit = true;
		}
		acm.showAttachmentListUIByBoID(boID, this, isEdit);
	}

	public void actionCustomerView_actionPerformed(ActionEvent e) throws Exception {
		if (getCustomerPromptBox() == null) {
			return;
		}
		if ((getCustomerPromptBox().getData() instanceof CustomerInfo)) {
			CustomerInfo vo = (CustomerInfo) getCustomerPromptBox().getData();
			CSClientUtils.CustomerView(vo.getId().toString(), this);
		}
	}

	public void actionSupplierView_actionPerformed(ActionEvent e) throws Exception {
		if (getSupplierPromptBox() == null) {
			return;
		}
		if ((getSupplierPromptBox().getData() instanceof SupplierInfo)) {
			SupplierInfo vo = (SupplierInfo) getSupplierPromptBox().getData();
			CSClientUtils.SupplierView(vo.getId().toString(), this);
		}
	}

	protected KDPromptBox getCustomerPromptBox() {
		return null;
	}

	protected KDPromptBox getSupplierPromptBox() {
		return null;
	}

	protected void checkIsOUSealUp() throws Exception {
		super.checkIsOUSealUp();
	}

	protected void initWorkButton() {
		super.initWorkButton();
		this.menuItemNextPerson.setIcon(EASResource.getIcon("imgTbtn_nextactor"));

		this.menuItemAudit.setIcon(EASResource.getIcon("imgTbtn_auditing"));
		this.btnAudit.setIcon(EASResource.getIcon("imgTbtn_auditing"));

		this.menuItemUnAudit.setIcon(EASResource.getIcon("imgTbtn_fauditing"));
		this.btnUnAudit.setIcon(EASResource.getIcon("imgTbtn_fauditing"));
		this.chkMenuItemSubmitAndPrint.setVisible(false);

		this.chkMenuItemSubmitAndAddNew.setSelected(false);
	}

	public void actionCreateFrom_actionPerformed(ActionEvent e) throws Exception {
		OrgUnitInfo mainOrg = null;
		HashMap botpMap = null;

		if ((getMainBizOrg() != null) && (getMainBizOrg().getValue() != null)) {
			mainOrg = (OrgUnitInfo) getMainBizOrg().getValue();
		}

		if (mainOrg == null) {
			if (getMainBizOrg() != null) {
				getMainBizOrg().requestFocus();
			}
			throw new SCMBillException(SCMBillException.NOMAINBIZORG);
		}

		botpMap = new HashMap();

		botpMap.put("MAINBIZORG.TYPE", getMainBizOrgType());

		botpMap.put("MAINBIZORG", mainOrg);
		botpMap.put("DESTBILLTYPE.ID", getBillTypeId());
		botpMap.put("DESTBIZTYPE.ID", getBizTypeId());

		botpMap.put("IGNORE_DATAPERMISSION_CHECK", Boolean.FALSE);

		botpMap.put("isSubContract", Boolean.valueOf(isSubContractBill()));
		if (getSCMHMDListUI() != null) {
			botpMap.put("SCM_HMD_LISTUI", getSCMHMDListUI());
		}

		getBillEdit().createFrom(getMainOrgContext(), botpMap);

		if (!this.isEditable)
			getNumTextField().setAccessAuthority(1);
		else
			getNumTextField().setEnabled(this.isEditable);
	}

	protected String getSCMHMDListUI() {
		return null;
	}

	protected void initNeedMainOrgF7s() {
	}

	protected KDBizPromptBox[] getNeedSetOrgF7s() {
		return this.prmtNeedOrgF7s;
	}

	private void setNumAfterOrgChg(String orgId) {
		if ("ADDNEW".equals(getOprtState())) {
			getNumTextField().setText(null);
		}

		if (orgId != null) {
			try {
				this.isAutoNumber = isAutoNumber(orgId);

				if (this.isAutoNumber) {
					this.isAddView = isAddView(orgId);

					if (this.isAddView) {
						String newNum = getSCMBizDataVO().getBillNumber() != null ? getSCMBizDataVO().getBillNumber() : getNewNumberByUnit(orgId);

						getNumTextField().setText(newNum);
						this.editData.setNumber(newNum);
						initOldData(this.editData);
					} else {
						this.editData.setNumber(null);
						initOldData(this.editData);
					}
				}

				setNumEditableWhenUnitChange(orgId);
			} catch (Exception e) {
				handUIException(e);
			}

		} else {
			this.editData.setNumber(null);
			initOldData(this.editData);
		}
	}

	protected void afterMainOrgChanged(String arg0, String arg1) {
		boolean isDiffrent = SCMGroupClientUtils.isDiffrent(arg0, arg1);
		try {
			this.mainOrg = ((OrgUnitInfo) getUIContext().get(getMainBizOrgType()));

			if (isDiffrent) {
				if (arg1 != null) {
					this.isFirstLoading = true;
				}
				loadSCMBizData();

				if ((getSCMBizDataVO() != null) && (getSCMBizDataVO().getPeriodYear() > 0) && (getMainStatusBar() != null)) {
					setCurPeriod(SCMClientUtils.getPeriodDisplay(getSCMBizDataVO().getPeriodYear(), getSCMBizDataVO().getPeriodNumber()));
				}

				setBizProcessControl();

				this.uiHelper.afterMainOrgChanged(arg0, arg1, getSCMBizDataVO());

				OrgUnitInfo org = null;
				if ((getMainBizOrg().getValue() instanceof OrgUnitInfo))
					org = (OrgUnitInfo) getMainBizOrg().getValue();
				if (getMainOrgContext() != null)
					getMainOrgContext().put(getMainBizOrgType(), org);

			}

			if ((getOprtState().equals("ADDNEW")) && (isDiffrent)) {
				setNumAfterOrgChg(arg1);
			}

			if (arg1 != null) {
				changeF7Context();

				if (isDiffrent) {
					super.doFieldPermission();
				}

			}

			if (("ADDNEW".equals(getOprtState())) && (isDiffrent)) {
				setDefaultOrgOnColumn(false);
			}
		} catch (Exception e) {
			handleException(e);
		}

		refreshFootROw(getDetailTable());
	}

	private void changeF7Context() {
		this.f7Manager.setMainOrgContext(getMainOrgContext());

		this.f7Manager.changeF7Context(getUIContext());
	}

	protected KDBizPromptBox getBizOrgF7(OrgType orgType, IColumn col) {
		KDBizPromptBox bizOrgUnitBox = new KDBizPromptBox();

		setBizOrgF7(bizOrgUnitBox, orgType, col);

		return bizOrgUnitBox;
	}

	protected void setBizOrgF7(KDBizPromptBox bizOrgUnitBox, OrgType orgType, IColumn col) {
		OrgUnitInfo orgInfo = null;

		bizOrgUnitBox.setDisplayFormat("$number$");
		bizOrgUnitBox.setEditFormat("$number$");

		bizOrgUnitBox.setCommitFormat("$number$;$code$");

		SCMGroupClientUtils.setBizOrgF7ByType(bizOrgUnitBox, orgType, getMainBizOrgType(), true);

		if (getMainOrgContext() != null) {
			orgInfo = (OrgUnitInfo) getMainOrgContext().get(getMainBizOrgType());

			if (orgInfo != null) {
				bizOrgUnitBox.setCurrentMainBizOrgUnit(orgInfo, getMainBizOrgType());
			}
		}

		if (col != null) {
			col.setEditor(new KDTDefaultCellEditor(bizOrgUnitBox));
		}
		bizOrgUnitBox.setEditable(true);
	}

	protected void setNeedMainOrgF7s(KDBizPromptBox[] f7s) {
		this.prmtNeedOrgF7s = f7s;
	}

	protected KDBizPromptBox getBizMaterialF7(IColumn col, String queryInfo) {
		OrgUnitInfo orgInfo = null;

		KDBizPromptBox bizMaterialBox = new KDBizPromptBox();

		registerDealMultiMateiralInfo(bizMaterialBox, col.getKey());

		if (getMainOrgContext() != null) {
			orgInfo = (OrgUnitInfo) getMainOrgContext().get(getMainBizOrgType());
		}

		this.f7Manager.registerBizMaterialF7(bizMaterialBox, col, queryInfo, orgInfo, true);

		return bizMaterialBox;
	}

	protected KDBizPromptBox getBizSupplierF7(IColumn col, String queryInfo) {
		KDBizPromptBox bizSupplierBox = new KDBizPromptBox();

		bizSupplierBox.setEditable(true);
		bizSupplierBox.setEditFormat("$number$");
		bizSupplierBox.setDisplayFormat("$number$");
		bizSupplierBox.setCommitFormat("$number$;$mnemonicCode$");
		setBizSupplierF7(bizSupplierBox, col, queryInfo);
		return bizSupplierBox;
	}

	protected void setBizSupplierF7(KDBizPromptBox bizSupplierBox, IColumn col, String queryInfo) {
		OrgUnitInfo orgInfo = null;

		if (getMainOrgContext() != null) {
			orgInfo = (OrgUnitInfo) getMainOrgContext().get(getMainBizOrgType());
		}

		this.f7Manager.registerBizSupplierF7(bizSupplierBox, col, queryInfo, orgInfo);
	}

	protected KDBizPromptBox getBizCustomerF7(IColumn col, String queryInfo) {
		KDBizPromptBox bizCustomerBox = new KDBizPromptBox();

		bizCustomerBox.setEditable(true);
		bizCustomerBox.setEditFormat("$number$");

		if (col != null)
			bizCustomerBox.setDisplayFormat("$name$");
		else
			bizCustomerBox.setDisplayFormat("$number$");
		bizCustomerBox.setCommitFormat("$number$;$mnemonicCode$");
		setBizCustomerF7(bizCustomerBox, col, queryInfo);
		return bizCustomerBox;
	}

	protected void setBizCustomerF7(KDBizPromptBox bizCustomerBox, IColumn col, String queryInfo) {
		OrgUnitInfo orgInfo = null;

		if (getMainOrgContext() != null) {
			orgInfo = (OrgUnitInfo) getMainOrgContext().get(getMainBizOrgType());
		}

		this.f7Manager.registerBizCustomerF7(bizCustomerBox, col, queryInfo, orgInfo);
	}

	protected void setMainBizOrgF7(KDBizPromptBox bizOrgUnitBox, OrgType orgType) {
		OrgUnitFilterInfoProducer iProducer = (OrgUnitFilterInfoProducer) FilterInfoProducerFactory.getOrgUnitFilterInfoProducer(orgType);

		String permissionItem = getPermissionItem(getOprtState());
		if (permissionItem != null) {
			iProducer.getModel().setPermissionItem(permissionItem);
		}
		bizOrgUnitBox.setFilterInfoProducer(iProducer);

		bizOrgUnitBox.setCommitFormat("$number$;$code$");
	}

	protected String getPermissionItem(String status) {
		return null;
	}

	protected String getBillTypeId() {
		SCMBillBaseInfo billInfo = (SCMBillBaseInfo) getEditData();
		if ((billInfo != null) && (billInfo.getBillType() != null)) {
			return billInfo.getBillType().getId().toString();
		}
		return null;
	}

	protected String getBizTypeId() {
		SCMBillBaseInfo billInfo = (SCMBillBaseInfo) getEditData();
		if ((billInfo != null) && (billInfo.getBizType() != null)) {
			return billInfo.getBizType().getId().toString();
		}
		return null;
	}

	/** @deprecated */
	protected CompanyOrgUnitInfo getMainCompanyOrg(String mainOrgId) {
		try {
			if ((getMainOrgInfo() != null) && (getMainOrgInfo().getId().toString().equals(mainOrgId))) {
				return (CompanyOrgUnitInfo) getDefaultDelegatedOrg(OrgType.Company);
			}
			if (mainOrgId == null) {
				OrgUnitInfo mainOrg = (OrgUnitInfo) getMainBizOrg().getValue();

				if (mainOrg != null)
					mainOrgId = mainOrg.getId().toString();
				else {
					return null;
				}
			}
			OrgUnitCollection orgs = SCMGroupClientUtils.getOrgsByRelation(getMainBizOrgType(), OrgType.Company, BOSUuid.read(mainOrgId));

			if ((orgs != null) && (orgs.size() > 0))
				return (CompanyOrgUnitInfo) orgs.get(0);
		} catch (Exception e) {
			handUIException(e);
		}

		return null;
	}

	protected final OrgUnitInfo getDefaultMainBizOrg() {
		if (this.mainOrg != null) {
			return this.mainOrg;
		}

		if (this.idxDefaultMainOrg > -1) {
			return this.mainOrgs[this.idxDefaultMainOrg];
		}
		if (this.mainOrgs == null) {
			try {
				this.mainOrgs = SCMServiceFactory.getPermissionService().getAuthorizedBizOrgUnits(
						new ObjectUuidPK(SysContext.getSysContext().getCurrentUserInfo().getId().toString()), getMainBizOrgType(), getPermissionItem("ADDNEW"));

				if ((this.mainOrgs == null) || (this.mainOrgs.length == 0)) {
					return null;
				}
				if (this.mainOrgs.length > 0)
					this.mainOrgs = ((OrgUnitInfo[]) SortUtil.sortDataByNumber(this.mainOrgs, true));
			} catch (Exception e) {
				handUIException(e);
			}
		}

		OrgUnitInfo currentMainOrg = SysContext.getSysContext().getCurrentOrgUnit(getMainBizOrgType());

		if ((currentMainOrg != null) && (this.mainOrgs != null) && (this.mainOrgs.length > 0)) {
			for (int i = 0; i < this.mainOrgs.length; i++) {
				if (!currentMainOrg.getId().toString().equals(this.mainOrgs[i].getId().toString()))
					continue;
				this.idxDefaultMainOrg = i;
				return currentMainOrg;
			}
		}

		if (this.mainOrgs.length > 0) {
			this.idxDefaultMainOrg = 0;
			return this.mainOrgs[0];
		}
		return null;
	}

	protected MaterialInfo[] verifyMaterials(MaterialInfo[] materials, int rowIdx, Map dataMap, String materialFieldname) throws Exception {
		return materials;
	}

	protected void applyBillDefaultValue(IObjectValue vo) {
		try {
			if (("ADDNEW".equals(getOprtState())) && ((vo instanceof CoreBillBaseInfo))) {
				CoreBillBaseInfo billInfo = (CoreBillBaseInfo) vo;
				billInfo.setCreator(SysContext.getSysContext().getCurrentUserInfo());

				if (billInfo.getCreateTime() == null) {
					Date today = new Date();
					billInfo.setCreateTime(new Timestamp(today.getTime()));
				}
			}
		} catch (Exception e) {
			handleException(e);
		}
	}

	protected void loadData() throws Exception {
		super.loadData();
	}

	private String getSetMethod(String propName) {
		return "set" + propName.substring(0, 1).toUpperCase() + propName.substring(1);
	}

	protected void setDepartmentF7(KDBizPromptBox bizOrgUnitBox) {
		OrgUnitInfo orgInfo = null;

		bizOrgUnitBox.setDisplayFormat("$number$");
		bizOrgUnitBox.setEditFormat("$number$");

		bizOrgUnitBox.setCommitFormat("$number$;$code$");

		bizOrgUnitBox.setQueryInfo("com.kingdee.eas.basedata.org.app.AdminOrgUnitQuery");
		IFilterInfoProducer iProducer = FilterInfoProducerFactory.getOrgUnitDelegationFilterInfoProducer(DelegationPartsEnum.THE_TO_UNIT, OrgType.Admin);

		OrgUnitDelegationFilterInfoProducer producer = (OrgUnitDelegationFilterInfoProducer) iProducer;
		producer.getModel().setDoNotUseUserOrgRangeAsFilter();

		bizOrgUnitBox.setFilterInfoProducer(producer);

		if (getMainOrgContext() != null) {
			orgInfo = (OrgUnitInfo) getMainOrgContext().get(getMainBizOrgType());

			if (orgInfo != null)
				bizOrgUnitBox.setCurrentMainBizOrgUnit(orgInfo, getMainBizOrgType());
		}
	}

	protected void initFetchData() throws Exception {
		SCMFetchDataCondition condition = buildCondition();
		if (condition == null) {
			return;
		}
		this.fetchData = SCMFetchDataFacadeFactory.getRemoteInstance().fetchData(condition.toEntiryView());
	}

	protected SCMFetchDataCondition buildCondition() {
		return null;
	}

	protected OrgUnitInfo getDefaultDelegatedOrg(OrgType orgType) throws EASBizException, BOSException, UuidException {
		return (OrgUnitInfo) getUIContext().get(orgType);
	}

	protected int getDefaultOrgMask() {
		return 0;
	}

	protected void setDefaultOrgMap(Map colMap) {
		this.defaultOrgOnCol = colMap;
	}

	private void setDefaultOrgOnColumn(boolean onlyEntry) {
		KDTable entryTable = getDetailTable();
		boolean isBotpBill = isBotpBill();
		try {
			if ((entryTable != null) && (this.defaultOrgOnCol != null) && (this.defaultOrgOnCol.size() > 0)) {
				Object[] cols = this.defaultOrgOnCol.keySet().toArray();

				for (int i = 0; i < entryTable.getRowCount(); i++) {
					for (int j = 0; j < cols.length; j++) {
						Object type = this.defaultOrgOnCol.get(cols[j]);
						if (type == null) {
							continue;
						}
						if ((type instanceof OrgType)) {
							if ((cols[j] instanceof String)) {
								if ((isBotpBill) && (entryTable.getCell(i, (String) cols[j]).getValue() != null)) {
									continue;
								}
								entryTable.getCell(i, (String) cols[j]).setValue(getDefaultDelegatedOrg((OrgType) type));
							} else {
								if ((onlyEntry) || (!(cols[j] instanceof KDPromptBox))) {
									continue;
								}
								if ((isBotpBill) && (((KDPromptBox) cols[j]).getValue() != null))
									continue;
								((KDPromptBox) cols[j]).setValue(getDefaultDelegatedOrg((OrgType) type));
							}

						} else if ((type instanceof Object[])) {
							if ((cols[j] instanceof String)) {
								if ((isBotpBill) && (entryTable.getCell(i, (String) cols[j]).getValue() != null)) {
									continue;
								}
								entryTable.getCell(i, (String) cols[j]).setValue(getDefaultDelegatedOrg((Object[]) type));
							} else {
								if ((onlyEntry) || (!(cols[j] instanceof KDPromptBox))) {
									continue;
								}
								if ((isBotpBill) && (((KDPromptBox) cols[j]).getValue() != null))
									continue;
								((KDPromptBox) cols[j]).setValue(getDefaultDelegatedOrg((Object[]) type));
							}
						}
					}
				}
			}

		} catch (Exception e) {
			super.handleException(e);
		}
	}

	private OrgUnitInfo getDefaultDelegatedOrg(Object[] types) {
		if (types.length != 2) {
			return null;
		}

		Integer key = new Integer(((OrgType) types[0]).getValue() * 10000 + ((OrgType) types[1]).getValue());

		return (OrgUnitInfo) getUIContext().get(key);
	}

	public void actionInsertLine_actionPerformed(ActionEvent e) throws Exception {
		getDetailTable().getEditManager().stopEditing();
		super.actionInsertLine_actionPerformed(e);
		if (getDetailTable() != null)
			if (getDetailTable().getRowCount() == 1) {
				setDefaultOrgOnColumn(true);
			} else if (getDetailTable().getRowCount() > 1) {
				setDefaultValueOnColumn(getDetailTable().getSelectManager().getActiveRowIndex(), 1);
			}
	}

	public void setFieldsToCopy(String[] fieldsToCopy) {
		this.fieldsToCopy = fieldsToCopy;
	}

	protected void setDefaultValueOnColumn(int beginIdx, int count) {
		if ((this.fieldsToCopy != null) && (this.fieldsToCopy.length > 0)) {
			Object[] values = new Object[this.fieldsToCopy.length];

			IRow arow = getDetailTable().getRow(beginIdx - 1);
			if (arow == null) {
				arow = getDetailTable().getRow(beginIdx + 1);
			}
			if (arow == null) {
				arow = getDetailTable().getRow(beginIdx);
			}
			if (arow != null) {
				for (int j = 0; j < this.fieldsToCopy.length; j++) {
					if (arow.getCell(this.fieldsToCopy[j]) != null) {
						values[j] = arow.getCell(this.fieldsToCopy[j]).getValue();
					}
				}

				for (int i = beginIdx; i < beginIdx + count; i++) {
					arow = getDetailTable().getRow(i);
					if (arow != null)
						for (int j = 0; j < this.fieldsToCopy.length; j++)
							if (arow.getCell(this.fieldsToCopy[j]) != null)
								arow.getCell(this.fieldsToCopy[j]).setValue(values[j]);
				}
			}
		}
	}

	protected void afterAddLine(KDTable table, IObjectValue lineData) {
		super.afterAddLine(table, lineData);
		if (getDetailTable() != null)
			if (getDetailTable().getRowCount() == 1) {
				setDefaultOrgOnColumn(true);
			} else if (getDetailTable().getRowCount() > 1) {
				setDefaultValueOnColumn(getDetailTable().getRowCount() - 1, 1);
			}
	}

	protected boolean isBillTotalRow() {
		return false;
	}

	protected void setTotalRow() {
	}

	protected void doFieldPermission() throws Exception {
	}

	protected void setCacheParameters(String[] parameters) {
		this.parameters = parameters;
	}

	protected void addParameters(String[] params) {
		if ((params == null) || (params.length == 0)) {
			return;
		}
		int size = params.length;
		if ((this.parameters != null) && (this.parameters.length > 0)) {
			size += this.parameters.length;
		}
		String[] params2 = new String[size];
		System.arraycopy(params, 0, params2, 0, params.length);
		if (params.length < size) {
			System.arraycopy(this.parameters, 0, params2, params.length, size - params.length);
		}
		this.parameters = params2;
	}

	protected final String getCacheParameter(String parameter) {
		return (String) this.parametersMap.get(parameter);
	}

	protected void clearWhenMaterialCleared(int rowIndex) {
	}

	protected void afterSubmitAddNew() {
		super.afterSubmitAddNew();
		try {
			OrgUnitInfo orgUnitInfo = (OrgUnitInfo) getMainOrgUnit().getData();

			if ((orgUnitInfo != null) && (orgUnitInfo.getId() != null)) {
				loadSCMBizData();

				String orgUnitId = orgUnitInfo.getId().toString();

				setNumAfterOrgChg(orgUnitId);
			} else {
				getNumTextField().setText(null);
				this.editData.setNumber(null);
			}
		} catch (Exception e) {
			getNumTextField().setText(null);
			this.editData.setNumber(null);
			handUIException(e);
		}
	}

	protected void removeLine(KDTable table) {
		if (table == null) {
			return;
		}
		if ((table.getSelectManager().size() == 0) || (isTableColumnSelected(table))) {
			MsgBox.showInfo(this, EASResource.getString("com.kingdee.eas.framework.FrameWorkResource.Msg_NoneEntry"));

			return;
		}

		if (confirmRemove()) {
			int size = table.getSelectManager().size();
			KDTSelectBlock selectBlock = null;
			KDTSelectBlock tempBlock = null;
			IRow iRow = null;

			Vector vtemp = new Vector(0);
			for (int i = 0; i < size; i++) {
				selectBlock = table.getSelectManager().get(i);
				boolean find = false;
				for (int j = 0; j < vtemp.size(); j++) {
					tempBlock = (KDTSelectBlock) vtemp.get(j);
					if (selectBlock.getTop() <= tempBlock.getTop()) {
						vtemp.add(j, selectBlock);
						find = true;
						break;
					}
				}
				if (!find) {
					vtemp.add(selectBlock);
				}

			}

			for (int i = size - 1; i >= 0; i--) {
				selectBlock = (KDTSelectBlock) vtemp.get(i);

				for (int j = selectBlock.getBottom(); j >= selectBlock.getTop(); j--) {
					iRow = table.getRow(j);
					if (iRow == null) {
						MsgBox.showInfo(this, EASResource.getString("com.kingdee.eas.framework.FrameWorkResource.Msg_NoneEntry"));

						return;
					}
					IObjectValue detailData = (IObjectValue) iRow.getUserObject();

					beforeRemoveLine(table, detailData);
					table.removeRow(j);

					IObjectCollection collection = (IObjectCollection) table.getUserObject();

					if (collection == null) {
						logger.error("collection not be binded to table");
					} else if (detailData != null) {
						int index = getCollectionIndex(collection, detailData);

						if (index != -1) {
							collection.removeObject(index);
						}
					}
					afterRemoveLine(table, detailData);
				}
			}
		}
	}

	protected int getCollectionIndex(IObjectCollection collection, IObjectValue obj) {
		int index = -1;
		if (collection == null) {
			return index;
		}
		for (int i = collection.size() - 1; i >= 0; i--) {
			if (obj == collection.getObject(i)) {
				index = i;
				return index;
			}
		}
		return index;
	}

	protected void setBizProcessControl() throws Exception {
		String targetBillBosTypeAndAliasString;
		if (getSCMBizDataVO() == null) {
			IBOTMapping iBOTMapping = BOTMappingFactory.getRemoteInstance();
			targetBillBosTypeAndAliasString = iBOTMapping.getTargetBillTypeList(this.editData.getBOSType().toString());
		} else {
			targetBillBosTypeAndAliasString = getSCMBizDataVO().getTargetBillBosTypeAndAlias();
		}
		if (targetBillBosTypeAndAliasString == null) {
			return;
		}

		this.workbtnBizProcess.removeAllAssistButton();
		this.menuBizProcess.removeAll();

		String[] targetBillBosTypeAndAliasArray = com.kingdee.eas.util.StringUtil.split(targetBillBosTypeAndAliasString, "|");

		if (targetBillBosTypeAndAliasArray.length != 2) {
			return;
		}

		String targetBillBosTypeString = targetBillBosTypeAndAliasArray[0];
		String targetBillAliasString = targetBillBosTypeAndAliasArray[1];
		String[] targetBillBosTypeArray = com.kingdee.eas.util.StringUtil.split(targetBillBosTypeString, ",");

		String[] targetBillAliasArray = com.kingdee.eas.util.StringUtil.split(targetBillAliasString, ",");

		processTargetBillArray(targetBillBosTypeArray, targetBillAliasArray);

		int i = 0;
		for (int size = targetBillBosTypeArray.length; i < size; i++) {
			if (targetBillBosTypeArray[i] == null)
				continue;
			Map param = getParamMap(targetBillAliasArray[i], targetBillBosTypeArray[i]);

			ActionBizProcess actionBizProcess = getActionBizProcess(param);

			KDMenuItem menuItem = new KDMenuItem();
			menuItem.setName(targetBillAliasArray[i]);
			menuItem.setAction(actionBizProcess);
			this.menuBizProcess.add(menuItem);
			this.workbtnBizProcess.addAssistMenuItem(actionBizProcess);
		}

		showBotpMenu();
	}

	protected void processTargetBillArray(String[] targetBillBosTypeArray, String[] targetBillAliasArray) {
	}

	public void createToBill(Map map) throws Exception {
		String destBillBosType = (String) map.get("DESCBILL_BOSTYPE");

		checkForCreateToBill();

		if ((this.editData.getId() == null) || (destBillBosType == null)) {
			return;
		}

		if (getBillEdit() != null) {
			Map btpNavCtx = (Map) getUIContext().get("BTPNAVCTX");
			if (btpNavCtx == null) {
				btpNavCtx = new HashMap();
				getUIContext().put("BTPNAVCTX", btpNavCtx);
			}
			if (isSubContractBill()) {
				btpNavCtx.put("isSubContract", Boolean.TRUE);
			}

			getBillEdit().CreateTo(this.editData, destBillBosType);
		}
	}

	protected void checkForCreateToBill() {
		int billBaseStatusValue = this.editData.getBaseStatus().getValue();

		if ((billBaseStatusValue == 0) || (billBaseStatusValue == 1) || (billBaseStatusValue == 2) || (billBaseStatusValue == 6) || (billBaseStatusValue == -2)
				|| (billBaseStatusValue == 3)) {
			MsgBox.showInfo(this.editData.getBaseStatus().getAlias()
					+ EASResource.getString("com.kingdee.eas.scm.common.SCMResource", "BASESTATUS_CANNOT_BOTP"));
			SysUtil.abort();
		}
	}

	protected boolean beforeActionBizProcess(Map map) {
		return true;
	}

	protected ActionBizProcess getActionBizProcess(Map map) {
		ActionBizProcess actionBizProcess = new ActionBizProcess(this, map);
		getActionManager().registerAction("actionBizProcess", actionBizProcess);

		actionBizProcess.addService(new PermissionService());

		actionBizProcess.addService(new NetFunctionService());

		actionBizProcess.addService(new UserMonitorService());

		return actionBizProcess;
	}

	protected Map getParamMap(String name, String destBillBosType) {
		Map map = new HashMap();
		map.put("MENU_NAME", name);
		map.put("ShortDescription", name);
		map.put("LongDescription", name);
		map.put("Name", name);
		map.put("DESCBILL_BOSTYPE", destBillBosType);

		return map;
	}

	protected void showBotpMenu() {
		boolean isShowBotpMenu = (checkValid()) && (this.workbtnBizProcess.getAssistButtonCount() > 0);

		this.menuBizProcess.setVisible(isShowBotpMenu);
		this.workbtnBizProcess.setVisible(isShowBotpMenu);
		this.sp_bizProcess.setVisible(isShowBotpMenu);
	}

	protected boolean checkValid() {
		return false;
	}

	protected void checkBillBaseStatusCanUnAudit() throws SCMBillException {
		String RES_PROMPT = "com.kingdee.eas.scm.common.SDSMResource";
		if (!this.editData.getBaseStatus().equals(BillBaseStatusEnum.AUDITED))
			throw new SCMBillException(SCMBillException.CHECKSTATEUNSTATE);
	}

	public void tableChange_Cal(KDTEditEvent e, ExchangeRateInfo exchangeRateinfo) throws Exception {
		this.uiHelper.tableChange_Cal(e, exchangeRateinfo);
	}

	public void calEntryLocalAmount(int rowIndex, ExchangeRateInfo exchangeRateinfo) {
		this.uiHelper.calEntryLocalAmount(rowIndex, exchangeRateinfo);
	}

	public void calByEntryQtyChange(int rowIndex, int colIndex) throws EASBizException, BOSException {
		this.uiHelper.calByEntryQtyChange(rowIndex, colIndex);
	}

	public void calByEntryPriceChange(int rowIndex, int colIndex) {
		this.uiHelper.calByEntryPriceChange(rowIndex, colIndex);
	}

	public void calByEntryTaxPriceChange(int rowIndex, int colIndex) {
		this.uiHelper.calByEntryTaxPriceChange(rowIndex, colIndex);
	}

	public void calTotalTaxAmount() {
		this.uiHelper.calTotalTaxAmount();
	}

	public void calTotalAmount() {
		this.uiHelper.calTotalAmount();
	}

	public void calTotalTax() {
		this.uiHelper.calTotalTax();
	}

	public void calEntryBaseQty(int rowIndex, int colIndex) throws EASBizException, BOSException {
		this.uiHelper.calEntryBaseQty(rowIndex, colIndex);
	}

	public void calEntryAssistQty(int rowIndex, int colIndex) throws EASBizException, BOSException {
		this.uiHelper.calEntryAssistQty(rowIndex, colIndex);
	}

	public void calEntryTaxPrice(int rowIndex, int colIndex) {
		this.uiHelper.calEntryTaxPrice(rowIndex, colIndex);
	}

	public void calEntryTaxPricebyPrice(int rowIndex, int colIndex) {
		this.uiHelper.calEntryTaxPricebyPrice(rowIndex, colIndex);
	}

	public void calEntryPriceByTaxPrice(int rowIndex, int colIndex) {
		this.uiHelper.calEntryPriceByTaxPrice(rowIndex, colIndex);
	}

	public void calEntryPriceByAmount(int rowIndex, int colIndex) {
		this.uiHelper.calEntryPriceByAmount(rowIndex, colIndex);
	}

	public void calEntryDiscountAmount(int rowIndex, int colIndex) {
		this.uiHelper.calEntryDiscountAmount(rowIndex, colIndex);
	}

	public void calEntryDiscountByDiscountAmount(int rowIndex, int colIndex) {
		this.uiHelper.calEntryDiscountByDiscountAmount(rowIndex, colIndex);
	}

	public void calEntryDiscountByActualPrice(int rowIndex, int colIndex) {
		this.uiHelper.calEntryDiscountByActualPrice(rowIndex, colIndex);
	}

	public void calEntryDiscountByActualTaxPrice(int rowIndex, int colIndex) {
		this.uiHelper.calEntryDiscountByActualTaxPrice(rowIndex, colIndex);
	}

	public void calEntryActualTaxPrice(int rowIndex, int colIndex) {
		this.uiHelper.calEntryActualTaxPrice(rowIndex, colIndex);
	}

	public void calEntryActualPrice(int rowIndex, int colIndex) {
		this.uiHelper.calEntryActualPrice(rowIndex, colIndex);
	}

	public void calEntryDiscountAmountByActualTaxPrice(int rowIndex, int colIndex) {
		this.uiHelper.calEntryDiscountAmountByActualTaxPrice(rowIndex, colIndex);
	}

	public void calEntryAmount(int rowIndex, int colIndex) {
		this.uiHelper.calEntryAmount(rowIndex, colIndex);
	}

	public void calEntryTax(int rowIndex, int colIndex) {
		this.uiHelper.calEntryTax(rowIndex, colIndex);
	}

	public void calEntryTotalTaxAmount(int rowIndex, int colIndex) {
		this.uiHelper.calEntryTotalTaxAmount(rowIndex, colIndex);
	}

	public void setTaxMaxValue(int rowIndex) {
		this.uiHelper.setTaxMaxValue(rowIndex);
	}

	public void setDicountPrecision(int rowIndex) {
		this.uiHelper.setDiscountPrecision(rowIndex);
	}

	public void setDiscountAmountMaxValue(int rowIndex) {
		this.uiHelper.setDiscountAmountMaxValue(rowIndex);
	}

	public void setActualTaxPriceMaxValue(int rowIndex) {
		this.uiHelper.setActualTaxPriceMaxValue(rowIndex);
	}

	public void setSENDRATEMaxValue(int rowIndex) {
		this.uiHelper.setSENDRATEMaxValue(rowIndex);
	}

	public void entryUnitChange(int rowIndex, MeasureUnitInfo curUnitOldValue, boolean isPrice, boolean isQtyTrans) {
		this.uiHelper.entryUnitChange(rowIndex, curUnitOldValue, isPrice, isQtyTrans);
	}

	public void entryUnitChange(int rowIndex, MeasureUnitInfo curUnitOldValue, boolean isPrice) {
		this.uiHelper.entryUnitChange(rowIndex, curUnitOldValue, isPrice);
	}

	public OrgUnitInfo getMainOrgInfo() {
		if (getMainOrgContext() == null) {
			return (OrgUnitInfo) super.getUIContext().get(getMainBizOrgType());
		}
		return (OrgUnitInfo) getMainOrgContext().get(getMainBizOrgType());
	}

	protected void multiApproveIfInWF() throws BOSException, Exception {
		if ((!this.editData.getBaseStatus().equals(BillBaseStatusEnum.SUBMITED)) && (!this.editData.getBaseStatus().equals(BillBaseStatusEnum.ALTERING))) {
			throw new SCMBillException(SCMBillException.BILLMUSTSUBMIT);
		}

		String[] idListArray = new String[1];
		idListArray[0] = this.editData.getId().toString();

		if (SCMClientUtils.checkAllBizObjInWfProcess(idListArray)) {
			actionMultiapprove_actionPerformed(null);
			SysUtil.abort();
		}
	}

	protected void refreshCurPage() throws EASBizException, BOSException, Exception {
		if (this.editData.getId() != null) {
			IObjectPK iObjectPk = new ObjectUuidPK(this.editData.getId());
			IObjectValue iObjectValue = getValue(iObjectPk);
			setDataObject(iObjectValue);
			loadFields();
			setSave(true);
		}
	}

	protected void loadSCMBizData() throws EASBizException, BOSException {
		SCMBizDataVO vo = new SCMBizDataVO(getMainBizOrgType(), getMainOrgInfo(), getDefaultOrgMask(), SysContext.getSysContext().getCurrentUserInfo(),
				getBindingProperty());

		vo.setParameters(this.parameters);

		vo.setBOSType(this.editData.getBOSType().toString());
		vo.setOprtState(getOprtState());

		initSCMBizDataVO(vo);

		if (this.defaultOrgOnCol != null) {
			HashSet set = new HashSet();
			set.addAll(this.defaultOrgOnCol.values());
			vo.setDelegatedOrgTypes(set);
		}

		vo.setFirstLoading(this.isFirstLoading);

		this.bizDataVO = this.uiHelper.loadSCMBizData(vo);

		if (this.bizDataVO != null) {
			if (this.bizDataVO.getDefaultDelegatedOrg() != null) {
				getUIContext().putAll(this.bizDataVO.getDefaultDelegatedOrg());
			}
			this.ruleStatus = this.bizDataVO.getRuleStatus();
			Map map = this.bizDataVO.getParametersMap();
			if (map != null) {
				this.parametersMap = map;
			}

			FixedDataCache.getInstance().putInCache(vo.getScmEntryDataVO(), this.bizDataVO.getScmEntryDataVO());
		}

		if (this.isFirstLoading)
			this.isFirstLoading = false;
	}

	protected void initSCMBizDataVO(SCMBizDataVO vo) {
	}

	protected SCMBizDataVO getSCMBizDataVO() {
		return this.bizDataVO;
	}

	protected void initContextOrg() {
		if (getMainBizOrg() == null) {
			super.initContextOrg();
		} else {
			getUIContext().put(getMainBizOrgType(), null);
		}
	}

	protected IUiHandling getUiHandlingHelper() {
		return this.uiHelper;
	}

	private boolean isFromWF() {
		return (getUIContext() != null) && ((Boolean) getUIContext().get("isMultiApprove") == Boolean.TRUE);
	}

	protected void initOldData(IObjectValue dataObject) {
		if (this.uiHelper != null)
			this.uiHelper.setEditData((SCMBillBaseInfo) dataObject);
		super.initOldData(dataObject);
	}

	protected final void syncOldData(IObjectValue dataObject) {
	}

	protected boolean confirmUnAduit() {
		return MsgBox.isYes(MsgBox.showConfirm2(this, EASResource.getString("com.kingdee.eas.scm.common.SCMResource.isConfirmUnAudit")));
	}

	public boolean isFirstLoading() {
		return this.isFirstLoading;
	}

	protected void registerRowType(KDBizPromptBox bizBox, String columnName) {
		this.rowTypeIndex = columnName;
		KDBizPromptBox bizRowType = new KDBizPromptBox();

		bizRowType.setQueryInfo("com.kingdee.eas.basedata.scm.common.app.F7RowTypeQuery");

		bizRowType.setEditFormat("$number$");
		bizRowType.setDisplayFormat("$name$");
		bizRowType.setCommitFormat("$number$");
		bizRowType.setEditable(true);
		getDetailTable().getColumn(columnName).setEditor(new KDTDefaultCellEditor(bizRowType));
		ObjectValueRender avr = new ObjectValueRender();
		avr.setFormat(new BizDataFormat("$name$"));
		getDetailTable().getColumn(columnName).setRenderer(avr);
		bizRowType.addDataChangeListener(new DataChangeListener() {
			public void dataChanged(DataChangeEvent e) {
				try {
					SCMBillEditUI.this.prmtRowTypeDataChanged(e);
				} catch (Exception exc) {
					SCMBillEditUI.this.handUIException(exc);
				} finally {
				}
			}
		});
		bizBox.addDataChangeListener(new DataChangeListener() {
			public void dataChanged(DataChangeEvent e) {
				try {
					SCMBillEditUI.this.prmtBizTypeDataChanged(e);
				} catch (Exception exc) {
					SCMBillEditUI.this.handUIException(exc);
				} finally {
				}
			}
		});
		if ((bizBox.getData() instanceof BizTypeInfo))
			setRowTypeFilter((BizTypeInfo) bizBox.getData());
		else if (((bizBox.getData() instanceof TransactionTypeInfo)) && (getDetailTable().getColumn(this.rowTypeIndex).getEditor() != null))
			setRowTypeFilter((TransactionTypeInfo) bizBox.getData());
	}

	public void prmtBizTypeDataChanged(DataChangeEvent e) {
		if (e.getOldValue() == e.getNewValue())
			return;
		if ((e.getNewValue() instanceof BizTypeInfo))
			setRowTypeFilter((BizTypeInfo) e.getNewValue());
		else if ((e.getNewValue() instanceof TransactionTypeInfo))
			setRowTypeFilter((TransactionTypeInfo) e.getNewValue());
	}

	public void prmtRowTypeDataChanged(DataChangeEvent e) {
		int currentrow = getDetailTable().getSelectManager().getActiveRowIndex();
		if (e.getNewValue() == null) {
			if (getClearColNameByRowType() != null) {
				int i = 0;
				for (int c = getClearColNameByRowType().length; i < c; i++) {
					getDetailTable().getRow(currentrow).getCell(getClearColNameByRowType()[i]).setValue(null);
				}
			}
			SysUtil.abort();
		}
		if ((currentrow != this.oldRowIndex) && (e.getOldValue() == e.getNewValue())) {
			this.oldRowIndex = getDetailTable().getSelectManager().getActiveRowIndex();
			SysUtil.abort();
		}
		if ((getDetailTable().getRow(currentrow).getCell(this.rowTypeIndex).getValue() instanceof RowTypeInfo)) {
			RowTypeInfo typeinfo = (RowTypeInfo) getDetailTable().getRow(currentrow).getCell(this.rowTypeIndex).getValue();
			if (typeinfo.getId().equals(((RowTypeInfo) e.getNewValue()).getId())) {
				setDefaultByRowType(e);
				SysUtil.abort();
			}
		}

		if (getClearColNameByRowType() != null) {
			int i = 0;
			for (int c = getClearColNameByRowType().length; i < c; i++) {
				getDetailTable().getRow(currentrow).getCell(getClearColNameByRowType()[i]).setValue(null);
			}
		}
		this.oldRowIndex = getDetailTable().getSelectManager().getActiveRowIndex();
	}

	protected void setDefaultByRowType(DataChangeEvent e) {
	}

	private void setRowTypeFilter(BizTypeInfo bizinfo) {
		ICellEditor ce = getDetailTable().getColumn(this.rowTypeIndex).getEditor();
		if (ce != null) {
			KDBizPromptBox bizBox = (KDBizPromptBox) ce.getComponent();
			EntityViewInfo view = bizBox.getEntityViewInfo();
			if (view == null) {
				view = new EntityViewInfo();
			}
			FilterInfo filterinfo = new FilterInfo();
			FilterItemInfo filterItemInfo = new FilterItemInfo("bizType.id", bizinfo.getId().toString(), CompareType.EQUALS);
			filterinfo.getFilterItems().add(filterItemInfo);
			if (view.getFilter() != null)
				try {
					boolean isHasRowTypeFilter = false;
					FilterItemInfo tmpFilter = null;
					int i = 0;
					for (int c = view.getFilter().getFilterItems().size(); i < c; i++) {
						tmpFilter = view.getFilter().getFilterItems().get(i);
						if (tmpFilter.getPropertyName().indexOf("bizType.id") >= 0) {
							isHasRowTypeFilter = true;
							view.getFilter().getFilterItems().set(i, filterItemInfo);
							break;
						}
					}
					if (!isHasRowTypeFilter)
						view.getFilter().mergeFilter(filterinfo, "and");
				} catch (BOSException e1) {
					handUIException(e1);
				}
			else {
				view.setFilter(filterinfo);
			}
			bizBox.setEntityViewInfo(view);
		}
	}

	protected void setRowTypeFilter(TransactionTypeInfo bizinfo) {
		KDBizPromptBox bizBox = (KDBizPromptBox) getDetailTable().getColumn(this.rowTypeIndex).getEditor().getComponent();
		EntityViewInfo view = bizBox.getEntityViewInfo();
		if (view == null) {
			view = new EntityViewInfo();
		}

		FilterInfo filterinfo = new FilterInfo();
		FilterItemInfo filterItemInfo = new FilterItemInfo("bizType.id", bizinfo.getBizType().getId().toString(), CompareType.EQUALS);
		filterinfo.getFilterItems().add(filterItemInfo);
		if (view.getFilter() != null)
			try {
				boolean isHasRowTypeFilter = false;
				FilterItemInfo tmpFilter = null;
				int i = 0;
				for (int c = view.getFilter().getFilterItems().size(); i < c; i++) {
					tmpFilter = view.getFilter().getFilterItems().get(i);
					if (tmpFilter.getPropertyName().indexOf("bizType.id") >= 0) {
						isHasRowTypeFilter = true;
						view.getFilter().getFilterItems().set(i, filterItemInfo);
						break;
					}
				}
				if (!isHasRowTypeFilter)
					view.getFilter().mergeFilter(filterinfo, "and");
			} catch (BOSException e1) {
				handUIException(e1);
			}
		else {
			view.setFilter(filterinfo);
		}
		bizBox.setEntityViewInfo(view);
	}

	protected void beforeRemoveLine(KDTable talbe, IObjectValue detailData) {
	}

	protected String[] getClearColNameByRowType() {
		return null;
	}

	protected void initInFirstOnLoad() {
	}

	public void actionMultiapprove_actionPerformed(ActionEvent e) throws Exception {
		if ((!this.editData.getBaseStatus().equals(BillBaseStatusEnum.SUBMITED)) && (!this.editData.getBaseStatus().equals(BillBaseStatusEnum.ALTERING))) {
			throw new SCMBillException(SCMBillException.STATUSERROR_CANNOTMULTIAPPROVE);
		}
		super.actionMultiapprove_actionPerformed(e);
		Thread.sleep(3000L);
		setUnAuditStatus(true);
		setOprtState(OprtState.VIEW);
		refreshCurPage();
	}

	private void clearBotpViewInContext() {
		getUIContext().remove("BOTPViewStatus");
	}

	public IUIActionPostman prepareInit() {
		IUIActionPostman handler = super.prepareInit();
		if (!isPrepareInit()) {
			return handler;
		}
		RequestContext request = new RequestContext();

		prepareInit(request);
		handler.setRequestContext(request);
		return handler;
	}

	public void prepareInit(RequestContext request) {
		request.put("_SCMMAINORGTYPE", getMainBizOrgType());
		request.put("_SCMPERMISSIONITEM", getPermissionItem("ADDNEW"));
		request.put("_SCMMAINORG", getMainBizOrg().getValue());
		request.put("SYS_CU_ID", SysContext.getSysContext().getCurrentCtrlUnit().getId().toString());

		request.put("__SCMBIZDATA", initSCMBizDataVO());

		request.put("__SCMENTRYDATA", initSCMEntryDataVO());
		request.setMainOrgType(getMainBizOrgType());

		request.put("_EDITUI_CLASSNAME", getMetaDataPK().getFullName());
	}

	private SCMBizDataVO initSCMBizDataVO() {
		SCMBizDataVO vo = new SCMBizDataVO(getMainBizOrgType(), getMainOrgInfo(), getDefaultOrgMask(), SysContext.getSysContext().getCurrentUserInfo(),
				getBindingProperty());

		vo.setParameters(this.parameters);
		try {
			BOSObjectType bosType = getBizType();
			vo.setBOSType(bosType.toString());
		} catch (Exception e) {
			logger.error(e);
		}

		vo.setOprtState(getOprtState());

		initSCMBizDataVO(vo);

		if (this.defaultOrgOnCol != null) {
			HashSet set = new HashSet();
			set.addAll(this.defaultOrgOnCol.values());
			vo.setDelegatedOrgTypes(set);
		}

		vo.setFirstLoading(this.isFirstLoading);

		SCMEntryDataVO inDataVO = new SCMEntryDataVO();
		if (vo.isFirstLoading()) {
			FixedDataCache.getInstance().initDataLoading(inDataVO);
		}

		vo.setScmEntryDataVO(inDataVO);
		return vo;
	}

	protected SCMEntryDataVO initSCMEntryDataVO() {
		return this.uiHelper.initSCMEntryDataVO4RPC();
	}

	public void afterAction(BatchActionEnum bizAction, BatchSelectionEntries selectionEntries, int countSuccess) {
		if (countSuccess == 0) {
			return;
		}
		String[] ids = selectionEntries.getToDoIdArray();
		IObjectPK pk = null;
		if ((ids[0] != null) && (!ids[0].equals("NEWID"))) {
			pk = new ObjectUuidPK(BOSUuid.read(ids[0]));
			if (bizAction.equals(BatchActionEnum.SUBMIT)) {
				try {
					doAfterSubmit(pk);
					this.curBizAction = null;
				} catch (Exception e) {
					handleException(e);
				}
			} else if (bizAction.equals(BatchActionEnum.SAVE)) {
				try {
					doAfterSave(pk);
				} catch (Exception e) {
					handleException(e);
				}
			} else if (bizAction.equals(BatchActionEnum.AUDIT)) {
				setOprtState("VIEW");
				this.curBizAction = null;
			} else if (bizAction.equals(BatchActionEnum.UNAUDIT)) {
				setSave(true);
				setSaved(true);
				this.curBizAction = null;
			}

		}

		if ((this.editData.getBaseStatus().equals(BillBaseStatusEnum.AUDITED)) && (getDetailTable() != null))
			getDetailTable().setEditable(false);
	}

	protected void doAfterSubmit(IObjectPK pk) throws Exception {
		super.doAfterSubmit(pk);

		if ((OprtState.ADDNEW.equals(getOprtState())) && ((null == this.editData.getNumber()) || ("".equals(this.editData.getNumber().trim())))) {
			OrgUnitInfo orgUnitInfo = (OrgUnitInfo) getMainOrgUnit().getData();
			if ((orgUnitInfo != null) && (orgUnitInfo.getId() != null)) {
				loadSCMBizData();
				String orgUnitId = orgUnitInfo.getId().toString();
				setNumAfterOrgChg(orgUnitId);
			} else {
				getNumTextField().setText(null);
				this.editData.setNumber(null);
			}
		}
	}

	public void handleBatchException(ActionProxy actionProxy, BatchSelectionEntries selectionEntry) throws Exception {
	}

	public boolean beforeAction(BatchActionEnum bizAction, BatchSelectionEntries selectionEntries, ActionEvent event) {
		if ((selectionEntries != null) && (selectionEntries.getBatchResults() != null)) {
			IObjectCollection collection = selectionEntries.getBatchResults().getObjCollection();
			if ((collection != null) && (collection.size() > 0)) {
				collection.getObject(0).put("isFromGui", Boolean.TRUE);
			}
		}
		if (bizAction.equals(BatchActionEnum.AUDIT)) {
			if ((this.editData == null) || (this.editData.getId() == null) || (isModify())) {
				this.curBizAction = BatchActionEnum.AUDIT;
				String msg = EASResource.getString("com.kingdee.eas.scm.common.SCMResource.BillCantAudit");

				MsgBox.showWarning(this, msg);
				return false;
			}
		} else if (bizAction.equals(BatchActionEnum.UNAUDIT)) {
			this.curBizAction = BatchActionEnum.UNAUDIT;

			this.actionTraceUp.setEnabled(true);
			this.actionTraceDown.setEnabled(true);
			this.btnEdit.setEnabled(true);
		} else if (bizAction.equals(BatchActionEnum.SUBMIT)) {
			try {
				this.curBizAction = BatchActionEnum.AUDIT;
				doBeforeSubmit(event);

				this.editData.setBotpCallSave(false);
				selectionEntries.setEditdata(this.editData);
			} catch (Exception exp) {
				handleException(exp);
				return false;
			}
		} else if (bizAction.equals(BatchActionEnum.SAVE)) {
			try {
				doBeforeSave(event);
				this.editData.setBotpCallSave(false);

				this.editData.setBotpCallSave(false);
				selectionEntries.setEditdata(this.editData);
			} catch (Exception exp) {
				handleException(exp);
				return false;
			}
		} else if (bizAction.equals(BatchActionEnum.FIRST)) {
			String id = this.idList.getFirstID();
			if (id == null) {
				this.actionFirst.setEnabled(false);
				this.actionPre.setEnabled(false);
				return false;
			}
		} else if (bizAction.equals(BatchActionEnum.NEXT)) {
			if (this.idList.getCurrentIndex() > this.idList.size() - 1) {
				this.actionNext.setEnabled(false);
				this.actionLast.setEnabled(false);
				return false;
			}
		} else if (bizAction.equals(BatchActionEnum.PREVIOUS)) {
			if (this.idList.getCurrentIndex() == -1) {
				this.actionPre.setEnabled(false);
				this.actionFirst.setEnabled(false);
				this.idList.setCurrentIndex(0);
				return false;
			}
		} else if (bizAction.equals(BatchActionEnum.LAST)) {
			String id = this.idList.getLastID();
			if (id == null) {
				this.actionLast.setEnabled(false);
				this.actionNext.setEnabled(false);
				return false;
			}
		}
		return true;
	}

	public void doActionPerformed(BatchActionEnum bizAction, BatchSelectionEntries selectionEntry) {
	}

	public boolean isSupportedBatchActions() {
		return false;
	}

	public void refresh(BatchActionEnum bizAction, BatchSelectionEntries selectionEntries, int countSuccess) throws Exception {
		if (ActionProxyFactory.moveActionSet.contains(bizAction)) {
			String[] ids = selectionEntries.getToDoIdArray();
			IObjectPK pk = null;
			if (ids[0] != null) {
				pk = new ObjectUuidPK(BOSUuid.read(ids[0]));

				setOprtState("VIEW");
				try {
					IObjectValue objValue = getValue(pk);

					setDataObject(objValue);

					loadFields();

					showMessageForStatus();

					getUIContext().put("ID", ids[0]);

					getUIContext().put("InitDataObject", objValue);
				} catch (Exception e) {
					handleException(e);
				}
			}
		} else if ((!bizAction.equals(BatchActionEnum.SUBMIT)) && (!bizAction.equals(BatchActionEnum.SAVE))) {
			this.curBizAction = bizAction;
			refreshCurPage();
			this.curBizAction = null;
		}
	}

	protected void initBatchActions() throws BOSException {
		ActionProxy actionProxy = ActionProxyFactory.createActionProxy(BatchActionEnum.SUBMIT, this.actionSubmit, "submitRelations", this.actionManager
				.getContextType());

		this.actionManager.registerBatchAction(actionProxy, "actionSubmit");
		actionProxy.bindTo(this.btnSubmit);
		actionProxy.bindTo(this.menuItemSubmit);

		if (getUIContext().get("BillQuery") == null) {
			actionProxy = ActionProxyFactory.createActionProxy(BatchActionEnum.SAVE, this.actionSave, "saveRelations", this.actionManager.getContextType());

			this.actionManager.registerBatchAction(actionProxy, "actionSave");
			actionProxy.bindTo(this.btnSave);
			actionProxy.bindTo(this.menuItemSave);
		}

		actionProxy = ActionProxyFactory.createActionProxy(BatchActionEnum.AUDIT, this.actionAudit, "audit");
		this.actionManager.registerBatchAction(actionProxy, "actionAudit");
		actionProxy.bindTo(this.btnAudit);
		actionProxy.bindTo(this.menuItemAudit);

		actionProxy = ActionProxyFactory.createActionProxy(BatchActionEnum.UNAUDIT, this.actionUnAudit, "unAudit");
		this.actionManager.registerBatchAction(actionProxy, "actionUnAudit");
		actionProxy.bindTo(this.btnUnAudit);
		actionProxy.bindTo(this.menuItemUnAudit);
	}

	public ActionManager getActionManager() {
		if (this.actionManager == null) {
			this.actionManager = new SCMActionManager(this, ContextTypeEnum.INMAINTAINING);
			this.actionManager.setTableSelectionHelper(getTableSelectionHelper());
			this.actionManager.setServiceContext(getServiceContext());
		}
		return this.actionManager;
	}

	public RequestContext prepareActionCopy(IItemAction itemAction) throws Exception {
		if (this.editData.getSourceBillType() != null) {
			MsgBox.showError(this, SCMClientUtils.getResource("CANT_COPY_BOTPBILL"));

			this.actionCopy.setEnabled(false);
			SysUtil.abort();
		}
		RequestContext request = super.prepareActionCopy(itemAction);
		setOprtState("ADDNEW");
		prepareInit(request);
		return request;
	}

	public Context getMainContext() {
		return getMainOrgContext();
	}

	public RequestContext prepareRequestContext(BatchActionEnum bizAction, IItemAction itemAction) {
		IUIActionPostman handler = prepareInit();
		RequestContext request = (RequestContext) handler.getRequestContext();

		request.setSubmitAddNew((this.chkMenuItemSubmitAndAddNew.isSelected()) && (this.chkMenuItemSubmitAndAddNew.isVisible()));

		prepareInit(request);
		return request;
	}

	public RequestContext prepareActionAddNew(IItemAction itemAction) throws Exception {
		RequestContext request = super.prepareActionAddNew(itemAction);

		prepareInit(request);
		return request;
	}

	public RequestContext prepareActionSave(IItemAction itemAction) throws Exception {
		RequestContext request = super.prepareActionSave(itemAction);

		this.editData.setBotpCallSave(false);

		clearBotpViewInContext();

		return request;
	}

	public RequestContext prepareActionSubmit(IItemAction itemAction) throws Exception {
		RequestContext request = super.prepareActionSubmit(itemAction);

		this.editData.setBotpCallSave(false);

		clearBotpViewInContext();

		return request;
	}

	protected void PrepareHandlerParam(RequestContext request) {
		super.PrepareHandlerParam(request);

		prepareInit(request);
	}

	protected void handlePermissionForItemAction(ItemAction action) {
	}

	public boolean destroyWindow() {
		boolean b = super.destroyWindow();
		if (b) {
			if (this.billOptionsHelper != null) {
				this.billOptionsHelper.closeUI();
				this.billOptionsHelper = null;
			}
		}

		return b;
	}

	protected boolean showMenuInWorkFlow() {
		return true;
	}

	public IWorkflowUIEnhancement getWorkflowUIEnhancement() {
		SCMWFEnhancement scmWFEnhancement = new SCMWFEnhancement();
		if ((!showMenuInWorkFlow()) || (!isFromWF())) {
			return scmWFEnhancement;
		}
		boolean showQueryByMaterial = this.menuItemQueryByMaterial.isVisible();
		boolean showQueryGeneralInventory = this.menuItemQueryGeneralInventory.isVisible();
		int i = 0;
		for (int size = this.menuView.getItemCount(); i < size; i++) {
			if (this.menuView.getItem(i) != null)
				this.menuView.getItem(i).setVisible(false);
		}
		this.menuItemQueryByMaterial.setVisible(showQueryByMaterial);
		this.menuItemQueryGeneralInventory.setVisible(showQueryGeneralInventory);
		List aList = new ArrayList();
		aList.add(this.menuView);
		scmWFEnhancement.setMenuList(aList);
		return scmWFEnhancement;
	}

	public boolean isSubContractBill() {
		boolean isSubContractBill = false;

		Map uiContext = getUIContext();
		if (uiContext != null) {
			if (Boolean.TRUE.equals(uiContext.get("isSubContract"))) {
				isSubContractBill = true;
			} else if ("isSubContract".equals(uiContext.get("UIClassParam"))) {
				uiContext.put("isSubContract", Boolean.TRUE);
				isSubContractBill = true;
			} else if (uiContext.get("BTPNAVCTX") != null) {
				Map traceFromUIContext = (Map) uiContext.get("BTPNAVCTX");
				if (Boolean.TRUE.equals(traceFromUIContext.get("isSubContract"))) {
					uiContext.put("isSubContract", Boolean.TRUE);
					isSubContractBill = true;
				}
			} else if ((uiContext.get("BOTPViewStatus") != null) && (((Integer) uiContext.get("BOTPViewStatus")).intValue() == 1)) {
				if ((this.editData != null) && (this.editData.getInt("purchaseType") == 1)) {
					uiContext.put("isSubContract", Boolean.TRUE);
					isSubContractBill = true;
				}
			}
		}

		return isSubContractBill;
	}

	public boolean isSubContractBillData() {
		boolean isSubContractBillData = false;
		if ((this.editData != null) && (this.editData.getInt("purchaseType") == 1)) {
			Map uiContext = getUIContext();
			if (uiContext != null) {
				uiContext.put("isSubContract", Boolean.TRUE);
			}
			isSubContractBillData = false;
		}

		return isSubContractBillData;
	}

	protected String getAssistQtyName() {
		return "assistQty";
	}

	protected String getQtyName() {
		return "qty";
	}

	protected String getMaterialName() {
		return "material";
	}

	protected String getApproAssistQtyName() {
		return "approvedAssitQty";
	}

	protected String getApproQtyName() {
		return "approvedQty";
	}

	protected String getApproBaseQtyName() {
		return "approvedBaseQty";
	}

	protected String getBaseQtyName() {
		return "baseQty";
	}

	protected String getUnitName() {
		return "unit";
	}

	public void actionInvBillOption_actionPerformed(ActionEvent e) throws Exception {
		super.actionInvBillOption_actionPerformed(e);
		logger.info("Create " + InvBillOptionUI.class.getName() + " ............!");

		HashMap map = new HashMap();
		map.put("SCMBizDataVO", getSCMBizDataVO());
		map.put("assistForNumber", new Boolean(this.assistForNumber));
		map.put("numberForAssist", new Boolean(this.numberForAssist));
		map.put("billTypeId", getBillTypeId());
		map.put("stockTransferBillDefalutBizType", this.defaultBizTypeId);

		IUIWindow window = UIFactory.createUIFactory(UIFactoryName.MODEL).create(InvBillOptionUI.class.getName(), map);
		window.show();

		InvBillOptionUI billOptionUI = (InvBillOptionUI) window.getUIObject();
		if (billOptionUI.isSaveOption()) {
			HashMap optionConfigMap = (HashMap) getUIContext().get("OPTIONCONFIG");
			BillOptionsHelper helper = new BillOptionsHelper(this, optionConfigMap);
			helper.putConfigType("AssistForNumber", billOptionUI.assistForNumberCheckBox.isSelected());
			this.assistForNumber = billOptionUI.assistForNumberCheckBox.isSelected();
			helper.putConfigType("NumberForAssist", billOptionUI.numberForAssistCheckBox.isSelected());
			this.numberForAssist = billOptionUI.numberForAssistCheckBox.isSelected();
			BizTypeInfo defaultTti = (BizTypeInfo) billOptionUI.optionBizType.getValue();
			if ((defaultTti != null) && (!defaultTti.getId().toString().equals(this.defaultBizTypeId))) {
				this.defaultBizTypeId = defaultTti.getId().toString();
				helper.putConfigTypeToString("stockTransferBillDefalutBizType", this.defaultBizTypeId);
			}
		}
	}

	public void setQtyBaseQtyAssisQty(KDTable kdTable, int row, int col) throws EASBizException, BOSException {
		if ((kdTable.getCell(row, getMaterialName()).getValue() == null) || (kdTable.getRowCount() < row + 1)) {
			return;
		}
		MaterialInfo material = null;

		if (kdTable.getCell(row, getMaterialName()).getValue().getClass().isArray()) {
			material = ((MaterialInfo[]) kdTable.getCell(row, getMaterialName()).getValue())[0];
		} else {
			material = (MaterialInfo) kdTable.getCell(row, getMaterialName()).getValue();
		}
		BigDecimal baseQty = InvClientUtils.ZERO;
		BigDecimal assitQty = InvClientUtils.ZERO;
		BigDecimal qty = InvClientUtils.ZERO;
		if (kdTable.getCell(row, getUnitName()) == null) {
			return;
		}
		MeasureUnitInfo unit = (MeasureUnitInfo) kdTable.getCell(row, getUnitName()).getValue();
		if (unit == null) {
			return;
		}

		if (this.assistForNumber) {
			if (col == kdTable.getColumnIndex(getQtyName())) {
				if (kdTable.getCell(row, getQtyName()).getValue() != null) {
					qty = (BigDecimal) kdTable.getCell(row, getQtyName()).getValue();
				}
				baseQty = InvClientUtils.getConvsBaseQty(qty, this.fetchData.getUnitbaseConvsRate(material.getId().toString(), unit.getId().toString()),
						this.fetchData.getUnitPrecision(material.getId().toString(), material.getBaseUnit().getId().toString()).intValue());

				if (kdTable.getCell(row, getBaseQtyName()) != null) {
					kdTable.getCell(row, getBaseQtyName()).setValue(baseQty);
				}

				if (material.getAssistUnit() != null) {
					assitQty = InvClientUtils.getConvsAssQty(baseQty, this.fetchData.getUnitbaseConvsRate(material.getId().toString(), material.getAssistUnit()
							.getId().toString()), this.fetchData.getUnitPrecision(material.getId().toString(), material.getAssistUnit().getId().toString())
							.intValue());

					if (kdTable.getCell(row, getAssistQtyName()) != null) {
						kdTable.getCell(row, getAssistQtyName()).setValue(assitQty);
						if (kdTable.getCell(row, getApproAssistQtyName()) != null)
							kdTable.getCell(row, getApproAssistQtyName()).setValue(assitQty);
					}
				}
			} else if (col == kdTable.getColumnIndex(getApproQtyName())) {
				qty = (BigDecimal) kdTable.getCell(row, getApproQtyName()).getValue();
				if (qty == null)
					qty = InvClientUtils.ZERO;
				baseQty = InvClientUtils.getConvsBaseQty(qty, this.fetchData.getUnitbaseConvsRate(material.getId().toString(), unit.getId().toString()),
						this.fetchData.getUnitPrecision(material.getId().toString(), material.getBaseUnit().getId().toString()).intValue());

				if (kdTable.getCell(row, getApproBaseQtyName()) != null) {
					kdTable.getCell(row, getApproBaseQtyName()).setValue(baseQty);
				}
				if (material.getAssistUnit() != null) {
					assitQty = InvClientUtils.getConvsAssQty(baseQty, this.fetchData.getUnitbaseConvsRate(material.getId().toString(), material.getAssistUnit()
							.getId().toString()), this.fetchData.getUnitPrecision(material.getId().toString(), material.getAssistUnit().getId().toString())
							.intValue());

					if (kdTable.getCell(row, getApproAssistQtyName()) != null) {
						kdTable.getCell(row, getApproAssistQtyName()).setValue(assitQty);
					}
				}
			}
		}

		if (this.numberForAssist) {
			if (col == kdTable.getColumnIndex(getAssistQtyName())) {
				if ((getUnitName() == null) || (kdTable.getCell(row, getUnitName()).getValue() == null)) {
					return;
				}
				if (kdTable.getCell(row, getAssistQtyName()).getValue() != null) {
					assitQty = (BigDecimal) kdTable.getCell(row, getAssistQtyName()).getValue();
				}
				MeasureUnitInfo measureUnit = (MeasureUnitInfo) kdTable.getCell(row, getUnitName()).getValue();
				if (material.getAssistUnit() != null) {
					baseQty = InvClientUtils.getBaseQtyForAssQty(assitQty, this.fetchData.getUnitbaseConvsRate(material.getId().toString(), material
							.getAssistUnit().getId().toString()), this.fetchData.getUnitPrecision(material.getId().toString(),
							material.getAssistUnit().getId().toString()).intValue());

					qty = InvClientUtils.getQtyForBaseQty(baseQty, this.fetchData.getUnitbaseConvsRate(material.getId().toString(), unit.getId().toString()),
							this.fetchData.getUnitPrecision(material.getId().toString(), measureUnit.getId().toString()).intValue());

					if (kdTable.getCell(row, getBaseQtyName()) != null) {
						kdTable.getCell(row, getBaseQtyName()).setValue(baseQty);
					}

					if (kdTable.getCell(row, getQtyName()) != null) {
						kdTable.getCell(row, getQtyName()).setValue(qty);
						KDTEditEvent kdte = new KDTEditEvent(getDetailTable(), qty.add(new BigDecimal("0.1")), qty, row, kdTable.getCell(row, getQtyName())
								.getColumnIndex(), false, 1);

						Object[] listeners = getDetailTable().getListenerList().getListenerList();
						for (int i = listeners.length - 2; i >= 0; i -= 2) {
							if (listeners[i] == KDTEditListener.class) {
								((KDTEditListener) listeners[(i + 1)]).editStopped(kdte);
							}
						}
					}
				}

			} else if (col == kdTable.getColumnIndex(getApproAssistQtyName())) {
				if ((getUnitName() == null) || (kdTable.getCell(row, getUnitName()).getValue() == null)) {
					return;
				}
				if (kdTable.getCell(row, getApproAssistQtyName()).getValue() != null) {
					assitQty = (BigDecimal) kdTable.getCell(row, getApproAssistQtyName()).getValue();
				}
				MeasureUnitInfo measureUnit = (MeasureUnitInfo) kdTable.getCell(row, getUnitName()).getValue();
				if (material.getAssistUnit() != null) {
					baseQty = InvClientUtils.getBaseQtyForAssQty(assitQty, this.fetchData.getUnitbaseConvsRate(material.getId().toString(), material
							.getAssistUnit().getId().toString()), this.fetchData.getUnitPrecision(material.getId().toString(),
							material.getAssistUnit().getId().toString()).intValue());

					qty = InvClientUtils.getQtyForBaseQty(baseQty, this.fetchData.getUnitbaseConvsRate(material.getId().toString(), unit.getId().toString()),
							this.fetchData.getUnitPrecision(material.getId().toString(), measureUnit.getId().toString()).intValue());

					if (kdTable.getCell(row, getApproBaseQtyName()) != null) {
						kdTable.getCell(row, getApproBaseQtyName()).setValue(baseQty);
					}
					if ((kdTable.getCell(row, getApproQtyName()) != null)
							&& (qty.compareTo((BigDecimal) kdTable.getCell(row, getApproQtyName()).getValue()) != 0)) {
						if (kdTable.getCell(row, getApproQtyName()) != null) {
							kdTable.getCell(row, getApproQtyName()).setValue(qty);
						}
					}

				}

			}

			if (col == kdTable.getColumnIndex(getQtyName())) {
				if (kdTable.getCell(row, getQtyName()).getValue() != null) {
					qty = (BigDecimal) kdTable.getCell(row, getQtyName()).getValue();
				}
				baseQty = InvClientUtils.getConvsBaseQty(qty, this.fetchData.getUnitbaseConvsRate(material.getId().toString(), unit.getId().toString()),
						this.fetchData.getUnitPrecision(material.getId().toString(), material.getBaseUnit().getId().toString()).intValue());

				if (kdTable.getCell(row, getBaseQtyName()) != null)
					kdTable.getCell(row, getBaseQtyName()).setValue(baseQty);
			} else if (col == kdTable.getColumnIndex(getApproQtyName())) {
				if (kdTable.getCell(row, getApproQtyName()).getValue() != null) {
					qty = (BigDecimal) kdTable.getCell(row, getApproQtyName()).getValue();
				}
				baseQty = InvClientUtils.getConvsBaseQty(qty, this.fetchData.getUnitbaseConvsRate(material.getId().toString(), unit.getId().toString()),
						this.fetchData.getUnitPrecision(material.getId().toString(), material.getBaseUnit().getId().toString()).intValue());

				if (kdTable.getCell(row, getApproBaseQtyName()) != null) {
					kdTable.getCell(row, getApproBaseQtyName()).setValue(baseQty);
				}
			}
		}

		if ((!this.assistForNumber) && (!this.numberForAssist)) {
			if (col == kdTable.getColumnIndex(getQtyName())) {
				if (kdTable.getCell(row, getQtyName()).getValue() != null) {
					qty = (BigDecimal) kdTable.getCell(row, getQtyName()).getValue();
				}
				baseQty = InvClientUtils.getConvsBaseQty(qty, this.fetchData.getUnitbaseConvsRate(material.getId().toString(), unit.getId().toString()),
						this.fetchData.getUnitPrecision(material.getId().toString(), material.getBaseUnit().getId().toString()).intValue());

				if (kdTable.getCell(row, getBaseQtyName()) != null)
					kdTable.getCell(row, getBaseQtyName()).setValue(baseQty);
			} else if (col == kdTable.getColumnIndex(getApproQtyName())) {
				if (kdTable.getCell(row, getApproQtyName()).getValue() != null) {
					qty = (BigDecimal) kdTable.getCell(row, getApproQtyName()).getValue();
				}
				baseQty = InvClientUtils.getConvsBaseQty(qty, this.fetchData.getUnitbaseConvsRate(material.getId().toString(), unit.getId().toString()),
						this.fetchData.getUnitPrecision(material.getId().toString(), material.getBaseUnit().getId().toString()).intValue());

				if (kdTable.getCell(row, getApproBaseQtyName()) != null)
					kdTable.getCell(row, getApproBaseQtyName()).setValue(baseQty);
			}
		}
	}

	protected void addNeedMainOrgF7s(KDBizPromptBox[] f7s) {
		if ((f7s == null) || (f7s.length == 0))
			return;
		if (this.prmtNeedOrgF7s == null) {
			this.prmtNeedOrgF7s = f7s;
			return;
		}
		int size = f7s.length;
		if (this.prmtNeedOrgF7s != null) {
			size += this.prmtNeedOrgF7s.length;
		}
		KDBizPromptBox[] newF7s = new KDBizPromptBox[size];
		System.arraycopy(this.prmtNeedOrgF7s, 0, newF7s, 0, this.prmtNeedOrgF7s.length);
		System.arraycopy(f7s, 0, newF7s, this.prmtNeedOrgF7s.length, f7s.length);
		this.prmtNeedOrgF7s = newF7s;
	}

	public void fillCurEntryByFirsrRow(SCMBillEntryBaseInfo entryInfo, String[] filledColNames) {
		if ((getDetailTable() == null) || (getDetailTable().getRowCount() <= 1))
			return;
		IRow firstRow = getDetailTable().getRow(0);
		int i = 1;
		for (int size = filledColNames.length; i < size; i++)
			if (getDetailTable().getColumn(filledColNames[i]) != null)
				entryInfo.put(filledColNames[i], firstRow.getCell(filledColNames[i]).getValue());
	}

	public void fillCurEntryByFirsrRow(IRow curRow, String[] filledColNames) {
		if ((getDetailTable() == null) || (getDetailTable().getRowCount() <= 1) || (curRow == null))
			return;
		IRow firstRow = getDetailTable().getRow(0);
		int i = 1;
		for (int size = filledColNames.length; i < size; i++)
			if (getDetailTable().getColumn(filledColNames[i]) != null)
				curRow.getCell(filledColNames[i]).setValue(firstRow.getCell(filledColNames[i]).getValue());
	}

	protected Set getAutoFilledColNames() {
		Set colSet = new HashSet();
		return colSet;
	}

	public void fillAllEntriesByFirstRow(Object firstValue, String colName, int rowIndex) {
		if ((rowIndex != 0) || (colName == null) || (!getAutoFilledColNames().contains(colName)) || (getDetailTable() == null)
				|| (getDetailTable().getRowCount() <= 1) || (firstValue == null) || (getDetailTable().getColumn(colName) == null)) {
			return;
		}
		int i = 0;
		for (int size = getDetailTable().getRowCount(); i < size; i++)
			if (getDetailTable().getCell(i, colName).getValue() == null)
				getDetailTable().getCell(i, colName).setValue(firstValue);
	}

	protected void showSaveSuccess() {
		String saveMsg = "";
		String saveStr = SCMClientUtils.getResource("MSG_SAVE_OK");
		MessageFormat mf = new MessageFormat(saveStr);
		saveMsg = mf.format(new String[] { getClassAlise() });
		setMessageText(saveMsg);
		setNextMessageText(getClassAlise() + " " + EASResource.getString("com.kingdee.eas.framework.FrameWorkResource.Msg_Edit"));

		setShowMessagePolicy(0);
		setIsShowTextOnly(false);
		showMessage();
	}

	static {
		RPCInvokeStatckTrace.init();
	}

	protected class ActionBizProcess extends ItemAction {
		private Map param = null;

		public ActionBizProcess() {
			super();

			this.param = null;
		}

		public ActionBizProcess(IUIObject uiObject, Map map) {
			super();

			this.param = map;

			putValue("ShortDescription", (String) this.param.get("ShortDescription"));

			putValue("LongDescription", (String) this.param.get("LongDescription"));

			putValue("Name", (String) this.param.get("Name"));
		}

		public void actionPerformed(ActionEvent e) {
			if (!SCMBillEditUI.this.beforeActionBizProcess(this.param))
				return;
			try {
				SCMBillEditUI.this.createToBill(this.param);
			} catch (Exception ex) {
				SCMBillEditUI.this.handUIException(ex);
			}
		}
	}
}